2022-09-07 07:54:16 +03:00
|
|
|
@echo off
|
2022-09-09 13:09:13 +03:00
|
|
|
|
2022-09-12 11:41:47 +03:00
|
|
|
:: Run all commands using this script's directory as the working directory
|
|
|
|
cd %~dp0
|
|
|
|
|
2022-09-13 12:13:23 +03:00
|
|
|
:: copy over the first line from environment.yaml, e.g. name: ldm, and take the second word after splitting by ":" delimiter
|
|
|
|
for /F "tokens=2 delims=: " %%i in (environment.yaml) DO (
|
|
|
|
set v_conda_env_name=%%i
|
|
|
|
goto EOL
|
|
|
|
)
|
|
|
|
:EOL
|
2022-09-07 07:54:16 +03:00
|
|
|
|
2022-09-13 12:13:23 +03:00
|
|
|
echo Environment name is set as %v_conda_env_name% as per environment.yaml
|
2022-09-07 07:54:16 +03:00
|
|
|
|
2022-09-13 12:13:23 +03:00
|
|
|
:: Put the path to conda directory in a file called "custom-conda-path.txt" if it's installed at non-standard path
|
|
|
|
IF EXIST custom-conda-path.txt (
|
|
|
|
FOR /F %%i IN (custom-conda-path.txt) DO set v_custom_path=%%i
|
2022-09-07 07:54:16 +03:00
|
|
|
)
|
|
|
|
|
2022-09-13 12:13:23 +03:00
|
|
|
set v_paths=%ProgramData%\miniconda3
|
|
|
|
set v_paths=%v_paths%;%USERPROFILE%\miniconda3
|
|
|
|
set v_paths=%v_paths%;%ProgramData%\anaconda3
|
|
|
|
set v_paths=%v_paths%;%USERPROFILE%\anaconda3
|
2022-09-07 07:54:16 +03:00
|
|
|
|
2022-09-13 12:13:23 +03:00
|
|
|
for %%a in (%v_paths%) do (
|
2022-09-14 19:43:32 +03:00
|
|
|
IF NOT "%v_custom_path%"=="" (
|
|
|
|
set v_paths=%v_custom_path%;%v_paths%
|
|
|
|
)
|
2022-09-07 07:54:16 +03:00
|
|
|
)
|
|
|
|
|
2022-09-13 12:13:23 +03:00
|
|
|
for %%a in (%v_paths%) do (
|
2022-09-14 19:43:32 +03:00
|
|
|
if EXIST "%%a\Scripts\activate.bat" (
|
2022-09-13 12:13:23 +03:00
|
|
|
SET v_conda_path=%%a
|
2022-09-07 07:54:16 +03:00
|
|
|
echo anaconda3/miniconda3 detected in %%a
|
2022-09-13 12:13:23 +03:00
|
|
|
goto :CONDA_FOUND
|
2022-09-14 19:43:32 +03:00
|
|
|
)
|
2022-09-07 07:54:16 +03:00
|
|
|
)
|
|
|
|
|
2022-09-13 12:13:23 +03:00
|
|
|
IF "%v_conda_path%"=="" (
|
2022-09-07 07:54:16 +03:00
|
|
|
echo anaconda3/miniconda3 not found. Install from here https://docs.conda.io/en/latest/miniconda.html
|
2022-09-15 00:34:15 +03:00
|
|
|
pause
|
2022-09-07 07:54:16 +03:00
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
|
2022-09-13 12:13:23 +03:00
|
|
|
:CONDA_FOUND
|
|
|
|
|
2022-09-14 19:43:32 +03:00
|
|
|
if not exist "z_version_env.tmp" (
|
|
|
|
:: first time running, we need to update
|
2022-09-15 00:34:15 +03:00
|
|
|
set AUTO=1
|
2022-09-14 19:43:32 +03:00
|
|
|
call "update_to_latest.cmd"
|
2022-09-13 12:13:23 +03:00
|
|
|
)
|
2022-09-08 05:21:34 +03:00
|
|
|
|
2022-09-13 12:13:23 +03:00
|
|
|
call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%"
|
2022-09-07 07:54:16 +03:00
|
|
|
|
|
|
|
:PROMPT
|
|
|
|
set SETUPTOOLS_USE_DISTUTILS=stdlib
|
|
|
|
IF EXIST "models\ldm\stable-diffusion-v1\model.ckpt" (
|
2022-09-12 08:49:39 +03:00
|
|
|
python -m streamlit run scripts\webui_streamlit.py --theme.base dark
|
2022-09-07 07:54:16 +03:00
|
|
|
) ELSE (
|
2022-09-13 12:13:23 +03:00
|
|
|
echo Your model file does not exist! Place it in 'models\ldm\stable-diffusion-v1' with the name 'model.ckpt'.
|
|
|
|
pause
|
2022-09-12 11:41:47 +03:00
|
|
|
)
|