#!/usr/bin/env bash # ============================================================ # ONE COMMAND: sets up (first run) AND launches the app. # Everything (venv + downloaded models) is kept INSIDE this # folder, on whatever drive/mount you copied it to. Nothing # is installed system-wide. To clean up later: delete this folder. # ============================================================ set -e cd "$(dirname "$0")" # --- Point ALL caches (pip venv, HuggingFace, Torch, Ultralytics) at THIS folder --- export HF_HOME="$(pwd)/models_cache/huggingface" export TRANSFORMERS_CACHE="$(pwd)/models_cache/huggingface" export TORCH_HOME="$(pwd)/models_cache/torch" export ULTRALYTICS_CONFIG_DIR="$(pwd)/models_cache/ultralytics" export PIP_CACHE_DIR="$(pwd)/models_cache/pip" mkdir -p models_cache if [ ! -f ".venv/bin/activate" ]; then echo "[1/3] No environment found — creating one in .venv ..." python3 -m venv .venv fi echo "[2/3] Activating environment and installing/checking dependencies..." source .venv/bin/activate python -m pip install --upgrade pip -q pip install -r requirements.txt echo "[3/3] Launching app (first launch also downloads ~7GB of models into models_cache/)..." python app.py