#!/bin/bash set -e # Hugging Face defaults to port 7860 if not specified APP_PORT=${PORT:-7860} echo "📦 Running migrations..." # Note: Ensure your DB connection string is set in HF Space Secrets alembic upgrade head echo "🚀 Starting FastAPI on port $APP_PORT (Lean Mode)..." # Keep workers=1 to stay within the CPU/RAM efficiency lane exec uvicorn app.main:app \ --host 0.0.0.0 \ --port "$APP_PORT" \ --workers 1 \ --log-level info