Spaces:
Paused
Paused
| echo "π Activating Quantum-API Startup" | |
| # Start FastAPI in background on port 7860 | |
| echo "π Starting FastAPI (API backend) on port 7860..." | |
| uvicorn api.main:app --host 0.0.0.0 --port 7860 &> fastapi.log & | |
| # Capture PID for later kill | |
| FASTAPI_PID=$! | |
| # Wait a bit to ensure it starts | |
| sleep 3 | |
| # Check if FastAPI is running | |
| if ! ps -p $FASTAPI_PID > /dev/null; then | |
| echo "β FastAPI failed to start. Logs:" | |
| cat fastapi.log | |
| exit 1 | |
| else | |
| echo "β FastAPI is running as PID $FASTAPI_PID" | |
| fi | |
| # Start Streamlit in foreground (required by Hugging Face) | |
| echo "β¨ Launching Streamlit frontend on port 7860 (Hugging Face expects this)..." | |
| streamlit run app/app.py --server.port 8000 | |
| # Optional cleanup | |
| echo "π§Ή Shutting down FastAPI PID $FASTAPI_PID..." | |
| kill $FASTAPI_PID | |