add win installer

This commit is contained in:
Sanster 2022-10-25 14:41:01 +08:00
parent 9ce3500558
commit 8edc439952
3 changed files with 43 additions and 16 deletions

View File

@ -1,22 +1,30 @@
@echo off @echo off
export "PYTHONNOUSERSITE=1" set "PYTHONNOUSERSITE=1"
SET BUILD_DIST=lama-cleaner SET BUILD_DIST=lama-cleaner
SET BUILD_ENV=installer SET BUILD_ENV=installer
SET USER_SCRIPTS=user_scripts SET USER_SCRIPTS=user_scripts
echo "Creating a distributable package.."
source "~\miniconda3\etc\profile.d\conda.sh"
conda "install" "-c" "conda-forge" "-y" "conda-pack" echo Creating a distributable package..
conda "env" "create" "--prefix" "%BUILD_ENV%" "-f" "environment.yaml" @call conda env create --prefix %BUILD_ENV% -f environment.yaml
conda "activate" "%CD%\%BUILD_ENV%"
conda "pack" "--n-threads" "-1" "--prefix" "%BUILD_ENV%" "--format" "tar" echo Finish creating environment
mkdir "-p" "%BUILD_DIST%/%BUILD_ENV%" @call conda activate .\%BUILD_ENV%
@call conda install -c conda-forge -y conda-pack
@call conda pack --n-threads -1 --prefix %BUILD_ENV% --format tar
mkdir %BUILD_DIST%\%BUILD_ENV%
echo "Copy user scripts file %USER_SCRIPTS%" echo "Copy user scripts file %USER_SCRIPTS%"
COPY "%USER_SCRIPTS%/*" "%BUILD_DIST%" copy %USER_SCRIPTS%\* %BUILD_DIST%
cd "%BUILD_DIST%"
tar "-xf" "%CD%.\%BUILD_ENV%%CD%tar" "-C" "%BUILD_ENV%" cd %BUILD_DIST%
cd "%CD%." @call tar -xf ..\%BUILD_ENV%.tar -C %BUILD_ENV%
DEL /S "%BUILD_ENV%"
DEL "%BUILD_ENV%%CD%tar" cd ..
echo "zip %BUILD_DIST%%CD%zip" @call conda deactivate
zip "-q" "-r" "%BUILD_DIST%%CD%zip" "%BUILD_DIST%" rmdir /s /q %BUILD_ENV%
del %BUILD_ENV%.tar

View File

@ -0,0 +1,12 @@
@echo off
set PATH=C:\Windows\System32;%PATH%
@call installer\Scripts\activate.bat
@call conda-unpack
@call pip3 install -U torch==1.12.1 --extra-index-url https://download.pytorch.org/whl/cu116
@call pip3 install -U lama-cleaner
@call invoke config

View File

@ -0,0 +1,7 @@
@echo off
set PATH=C:\Windows\System32;%PATH%
@call installer\Scripts\activate.bat
@call invoke start