Spaces:
Running
Running
| set -e | |
| echo "Starting FastAPI server..." | |
| python -m uvicorn app.api.main:app --host 0.0.0.0 --port 8000 & | |
| UVICORN_PID=$! | |
| echo "Waiting for FastAPI to be ready..." | |
| TIMEOUT=30 | |
| ELAPSED=0 | |
| until curl -sf http://localhost:8000/api/v1/health > /dev/null; do | |
| if [ $ELAPSED -ge $TIMEOUT ]; then | |
| echo "ERROR: FastAPI did not start within ${TIMEOUT}s, aborting." | |
| kill $UVICORN_PID 2>/dev/null | |
| exit 1 | |
| fi | |
| sleep 1 | |
| ELAPSED=$((ELAPSED + 1)) | |
| done | |
| echo "FastAPI ready. Starting Gradio..." | |
| exec python gradio_app/app.py |