File size: 1,977 Bytes
9d908c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@echo off
setlocal enableextensions enabledelayedexpansion

REM Change to repo root (folder of this script)
cd /d "%~dp0"

REM ---------- Config ----------
set "VENV_DIR=AICoverGen"
set "PYTHON_EXE=%VENV_DIR%\Scripts\python.exe"
set "PIP_EXE=%VENV_DIR%\Scripts\pip.exe"

REM Activate virtual environment
call "%VENV_DIR%\Scripts\activate.bat"

REM Force ONNX Runtime to use CPU provider (PyTorch will still use GPU)
set "ORT_DISABLE_CUDA=1"

REM Optional: choose GPU index for PyTorch (0 = first GPU)
set "CUDA_VISIBLE_DEVICES=0"

REM Ensure UTF-8 output
set "PYTHONUTF8=1"
REM ----------------------------

REM Check venv
if not exist "%PYTHON_EXE%" (
  echo [ERROR] Virtual environment not found at %VENV_DIR%.^>
  echo         Expected: %PYTHON_EXE%
  echo         Create one first, or ensure the repo was set up correctly.
  echo.
  echo Example to create venv:
  echo   python -m venv AICoverGen
  exit /b 1
)

REM Upgrade pip (silent-ish)
"%PYTHON_EXE%" -m pip install --upgrade pip --disable-pip-version-check 1>nul 2>nul

REM Install core requirements
"%PIP_EXE%" install -r requirements.txt --no-input
if errorlevel 1 (
  echo [ERROR] Failed installing requirements.
  exit /b 1
)

REM Ensure a compatible Gradio version (3.50.2 is known-good with this UI)
"%PIP_EXE%" install "gradio==3.50.2" --no-input
if errorlevel 1 (
  echo [ERROR] Failed installing Gradio.
  exit /b 1
)

REM Check ffmpeg availability (recommended)
where ffmpeg >nul 2>nul
if errorlevel 1 (
  echo [WARN] ffmpeg not found in PATH. Audio processing may fail.
  echo       Install ffmpeg and add it to PATH: https://ffmpeg.org/download.html
)

REM Optional: open the UI in browser after a short delay
start "" /b cmd /c "timeout /t 3 /nobreak >nul & start http://127.0.0.1:7860"

REM Run the WebUI. Add --listen to allow LAN access if desired.
"%PYTHON_EXE%" src\webui.py %*

REM Preserve exit code
set "EXIT_CODE=%ERRORLEVEL%"
echo.
echo Server exited with code %EXIT_CODE%.
exit /b %EXIT_CODE%