Windows error handling

- cd to the script location on start of 'Start Stable Diffusion UI.cmd'
- Bail out when downloading micromamba fails
- add env variables SD_UI_BIND_IP and SD_UI_BIND_PORT to configure uvicorn
This commit is contained in:
JeLuF 2022-11-05 23:30:40 +01:00
parent cfa6dc7836
commit d3a90ccc0d
4 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,6 @@
@echo off
cd /d %~dp0
set PATH=C:\Windows\System32;%PATH%
@rem set legacy installer's PATH, if it exists

View File

@ -37,6 +37,12 @@ if "%PACKAGES_TO_INSTALL%" NEQ "" (
mkdir "%MAMBA_ROOT_PREFIX%"
call curl -L "%MICROMAMBA_DOWNLOAD_URL%" > "%MAMBA_ROOT_PREFIX%\micromamba.exe"
if "%ERRORLEVEL%" NEQ "0" (
echo "There was a problem downloading micromamba. Cannot continue."
pause
exit /b
)
@rem test the mamba binary
echo Micromamba version:
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version

View File

@ -343,6 +343,9 @@ call python --version
@set SD_UI_PATH=%cd%\ui
@cd stable-diffusion
@uvicorn server:app --app-dir "%SD_UI_PATH%" --port 9000 --host 0.0.0.0
@if NOT DEFINED SD_UI_BIND_PORT set SD_UI_BIND_PORT=9000
@if NOT DEFINED SD_UI_BIND_IP set SD_UI_BIND_PORT=0.0.0.0
@uvicorn server:app --app-dir "%SD_UI_PATH%" --port %SD_UI_BIND_PORT% --host %SD_UI_BIND_IP%
@pause

View File

@ -283,6 +283,6 @@ cd ..
export SD_UI_PATH=`pwd`/ui
cd stable-diffusion
uvicorn server:app --app-dir "$SD_UI_PATH" --port ${SDUI_BIND_PORT:-9000} --host ${SDUI_BIND_IP:-0.0.0.0}
uvicorn server:app --app-dir "$SD_UI_PATH" --port ${SD_UI_BIND_PORT:-9000} --host ${SD_UI_BIND_IP:-0.0.0.0}
read -p "Press any key to continue"