-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-translator.bat
More file actions
45 lines (38 loc) · 1.16 KB
/
Copy pathstart-translator.bat
File metadata and controls
45 lines (38 loc) · 1.16 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
@echo off
echo Starting LibreTranslate Server...
REM Check if LibreTranslate-main directory exists
if not exist "LibreTranslate-main" (
echo Error: LibreTranslate-main directory not found.
echo Please make sure the LibreTranslate-main folder is in the same directory as this script.
exit /b 1
)
REM Navigate to LibreTranslate directory
cd LibreTranslate-main
REM Check if Python is installed
python --version >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Error: Python is not installed or not in PATH.
exit /b 1
)
REM Check if pip is installed
pip --version >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Error: pip is not installed or not in PATH.
exit /b 1
)
REM Install dependencies if not already installed
if not exist "venv" (
echo Setting up virtual environment...
python -m venv venv
call venv\Scripts\activate.bat
pip install -e .
) else (
call venv\Scripts\activate.bat
)
REM Start LibreTranslate server
echo Starting LibreTranslate server...
echo The server will be available at http://localhost:5000
echo Press Ctrl+C to stop the server
libretranslate --host 0.0.0.0 --port 5000
REM Deactivate virtual environment when done
call venv\Scripts\deactivate.bat