Spaces:
Runtime error
Runtime error
| # Local run helper for macOS / Linux. Prints clear errors and the URL. | |
| set -e | |
| cd "$(dirname "$0")" | |
| # Pick a Python (prefer python3) | |
| PY="$(command -v python3 || command -v python || true)" | |
| if [ -z "$PY" ]; then | |
| echo "Python 3 not found. Install from https://www.python.org/downloads/ and retry." | |
| exit 1 | |
| fi | |
| echo "Using $($PY --version)" | |
| # Create / reuse venv | |
| [ -d .venv ] || "$PY" -m venv .venv | |
| # shellcheck disable=SC1091 | |
| source .venv/bin/activate | |
| echo "Installing dependencies (first run downloads ~200MB, please wait)..." | |
| python -m pip install --upgrade pip >/dev/null | |
| python -m pip install -r requirements.txt | |
| # OCR system deps are optional (only needed for scanned files / images) | |
| command -v tesseract >/dev/null || echo "Note: tesseract not installed (OCR disabled). Optional: brew install tesseract" | |
| echo "" | |
| echo "Starting server. Open -> http://localhost:8000" | |
| echo "(the first question downloads the embedding model, ~10s)" | |
| echo "" | |
| exec python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 | |