-
Notifications
You must be signed in to change notification settings - Fork 4
/
sdcpp_webui_windows.bat
executable file
·86 lines (75 loc) · 2.04 KB
/
sdcpp_webui_windows.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
@echo off
setlocal
set help=false
set valid=false
:: Get the directory of the batch script
set "SCRIPT_DIR=%~dp0"
cd /d "%SCRIPT_DIR%"
for %%A in (%*) do (
if "%%A"=="--help" (
set help=true
set valid=true
) else if "%%A"=="-h" (
set help=true
set valid=true
) else if "%%A"=="--listen" (
set valid=true
) else if "%%A"=="--autostart" (
set valid=true
) else if "%%A"=="--darkmode" (
set valid=true
)
)
if "%valid%"=="false" (
echo Unknown command parameter.
exit /b
)
if "%help%"=="true" (
echo.
echo.
echo Usage: sdcpp_webui_windows.bat [options]
echo.
echo Options:
echo -h or --help: Show this help
echo --listen: Share sd.cpp-webui on your local network
echo --autostart: Open the UI automatically
echo --darkmode: Forces the UI to launch in dark mode
echo.
echo.
exit /b
)
if not exist "sd.exe" (
echo.
echo.
echo Warning: 'sd' executable not found or doesn't have execute permissions.
echo For the command to work place the stable-diffusion.cpp executable in the main sd.cpp-webui folder.
echo The executable must be called 'sd.exe'.
echo.
echo.
)
if exist "venv" (
echo Virtual environment already exists.
) else (
echo Creating virtual environment...
python -m venv venv
echo Virtual environment created.
)
echo Activating virtual environment...
if exist "venv\Scripts\activate" (
call venv\Scripts\activate
) else (
echo Error: Virtual environment activation script not found.
exit /b 1
)
echo Virtual environment activated successfully.
pip freeze | findstr /i /x /g:requirements.txt >nul
if %errorlevel% equ 0 (
echo Requirements are satisfied.
) else (
echo Installing requirements...
pip install -r requirements.txt
echo Requirements installed.
)
echo Starting the WebUI...
python sdcpp_webui.py %*
endlocal