-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_web_gui.bat
More file actions
124 lines (110 loc) · 2.7 KB
/
Copy pathstart_web_gui.bat
File metadata and controls
124 lines (110 loc) · 2.7 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
@echo off
REM Quick start script for Web GUI on Windows
REM Usage: start_web_gui.bat
echo ================================================
echo Image Format Converter - Web GUI Launcher
echo ================================================
echo.
REM Check if Python is available
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo [X] Error: Python not found
echo Install from: https://www.python.org/downloads/
pause
exit /b 1
)
echo [+] Python found
python --version
REM Check if Flask is installed
python -c "import flask" >nul 2>&1
if %errorlevel% neq 0 (
echo [X] Flask not installed
echo Installing dependencies...
pip install Flask numpy Pillow opencv-python
if %errorlevel% neq 0 (
echo [X] Failed to install dependencies
echo Try manually: pip install -r requirements.txt
pause
exit /b 1
)
echo [+] Dependencies installed
)
echo [+] Flask installed
echo.
REM Parse arguments
set HOST=127.0.0.1
set PORT=5000
set EXTERNAL=0
:parse_args
if "%~1"=="" goto start_server
if /i "%~1"=="--external" (
set HOST=0.0.0.0
set EXTERNAL=1
shift
goto parse_args
)
if /i "%~1"=="-e" (
set HOST=0.0.0.0
set EXTERNAL=1
shift
goto parse_args
)
if /i "%~1"=="--port" (
set PORT=%~2
shift
shift
goto parse_args
)
if /i "%~1"=="-p" (
set PORT=%~2
shift
shift
goto parse_args
)
if /i "%~1"=="--help" goto show_help
if /i "%~1"=="-h" goto show_help
echo Unknown option: %~1
echo Use --help for usage information
pause
exit /b 1
:show_help
echo Usage: %~nx0 [OPTIONS]
echo.
echo Options:
echo -e, --external Allow external access (bind to 0.0.0.0)
echo -p, --port PORT Custom port (default: 5000)
echo -h, --help Show this help message
echo.
echo Examples:
echo %~nx0 # Start on localhost:5000
echo %~nx0 --external # Allow remote access
echo %~nx0 --port 8080 # Use port 8080
echo %~nx0 -e -p 8080 # External access on port 8080
pause
exit /b 0
:start_server
echo ================================================
echo Starting Web GUI Server
echo ================================================
echo.
echo Host: %HOST%
echo Port: %PORT%
echo.
if %EXTERNAL%==1 (
echo Access URLs:
echo Local: http://localhost:%PORT%
echo.
echo WARNING: External access enabled!
echo Server is accessible from other machines
echo.
) else (
echo Access URL: http://localhost:%PORT%
echo.
echo TIP: To allow remote access, use: %~nx0 --external
echo.
)
echo Press Ctrl+C to stop the server
echo ================================================
echo.
REM Start the server
python web_gui.py --host %HOST% --port %PORT%