add conda pack

This commit is contained in:
Qing 2022-10-02 14:25:53 +08:00
parent d4bd37682a
commit b00af182de
3 changed files with 56 additions and 0 deletions

7
scripts/environment.yaml Normal file
View File

@ -0,0 +1,7 @@
name: lama-cleaner
channels:
- defaults
- conda-forge
dependencies:
- conda

35
scripts/pack.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
set -e
export PYTHONNOUSERSITE=1
BUILD_DIST=lama-cleaner
BUILD_ENV=installer
echo "Creating a distributable package.."
source ~/miniconda3/etc/profile.d/conda.sh
conda install -c conda-forge -y conda-pack
conda env create --prefix $BUILD_ENV -f environment.yaml
conda activate ./$BUILD_ENV
conda pack --n-threads -1 --prefix $BUILD_ENV --format tar
mkdir -p ${BUILD_DIST}/$BUILD_ENV
echo "Copy project file.."
chmod u+x start.sh
cp start.sh $BUILD_DIST
cd $BUILD_DIST
tar -xf ../${BUILD_ENV}.tar -C $BUILD_ENV
cd ..
rm -rf $BUILD_ENV
rm ${BUILD_ENV}.tar
zip -r $BUILD_DIST.zip $BUILD_DIST

14
scripts/start.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
source installer/bin/activate
conda-unpack
conda --version
git --version
echo Using `which pip3`
pip3 install lama-cleaner
# TODO: add model input prompt
lama-cleaner --device cpu --model lama