#!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")" HOST="${HOST:-0.0.0.0}" PORT="${PORT:-8000}" # Prefer the project venv if one exists. if [[ -x ".venv/bin/uvicorn" ]]; then UVICORN=".venv/bin/uvicorn" elif command -v uvicorn >/dev/null 2>&1; then UVICORN="uvicorn" else echo "uvicorn not found. Run:" >&2 echo " .venv/bin/python -m pip install -r requirements.txt" >&2 exit 1 fi # Single worker because the registry holds in-process state # (camera workers, YOLO model, analytics). exec "$UVICORN" app.main:app --host "$HOST" --port "$PORT" --workers 1