File size: 1,376 Bytes
4bab068
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@echo off
REM ============================================================
REM  ONE COMMAND: sets up (first run) AND launches the app.
REM  Everything (venv + downloaded models) is kept INSIDE this
REM  folder, on whatever drive you copied it to. Nothing is
REM  installed system-wide. To clean up later: delete this folder.
REM ============================================================
setlocal
cd /d "%~dp0"

REM --- Point ALL caches (pip venv, HuggingFace, Torch, Ultralytics) at THIS folder ---
set "HF_HOME=%~dp0models_cache\huggingface"
set "TRANSFORMERS_CACHE=%~dp0models_cache\huggingface"
set "TORCH_HOME=%~dp0models_cache\torch"
set "ULTRALYTICS_CONFIG_DIR=%~dp0models_cache\ultralytics"
set "PIP_CACHE_DIR=%~dp0models_cache\pip"

if not exist "models_cache" mkdir "models_cache"

if not exist ".venv\Scripts\activate.bat" (
    echo [1/3] No environment found — creating one in .venv ...
    python -m venv .venv
    if errorlevel 1 (
        echo ERROR: Python not found on PATH. Install Python 3.10+ and re-run this script.
        pause
        exit /b 1
    )
)

echo [2/3] Activating environment and installing/checking dependencies...
call .venv\Scripts\activate.bat
python -m pip install --upgrade pip >nul
pip install -r requirements.txt

echo [3/3] Launching app (first launch also downloads ~7GB of models into models_cache\)...
python app.py

pause