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
export "PYTHONNOUSERSITE=1"
set "PYTHONNOUSERSITE=1"
SET BUILD_DIST=lama-cleaner
SET BUILD_ENV=installer
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"
conda "env" "create" "--prefix" "%BUILD_ENV%" "-f" "environment.yaml"
conda "activate" "%CD%\%BUILD_ENV%"
conda "pack" "--n-threads" "-1" "--prefix" "%BUILD_ENV%" "--format" "tar"
mkdir "-p" "%BUILD_DIST%/%BUILD_ENV%"
echo Creating a distributable package..
@call conda env create --prefix %BUILD_ENV% -f environment.yaml
echo Finish creating environment
@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%"
COPY "%USER_SCRIPTS%/*" "%BUILD_DIST%"
cd "%BUILD_DIST%"
tar "-xf" "%CD%.\%BUILD_ENV%%CD%tar" "-C" "%BUILD_ENV%"
cd "%CD%."
DEL /S "%BUILD_ENV%"
DEL "%BUILD_ENV%%CD%tar"
echo "zip %BUILD_DIST%%CD%zip"
zip "-q" "-r" "%BUILD_DIST%%CD%zip" "%BUILD_DIST%"
copy %USER_SCRIPTS%\* %BUILD_DIST%
cd %BUILD_DIST%
@call tar -xf ..\%BUILD_ENV%.tar -C %BUILD_ENV%
cd ..
@call conda deactivate
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