Spaces:
Paused
Paused
Commit
Β·
16c76cc
1
Parent(s):
e5cc10e
π§ Make start.sh Hugging Face-compatible and update .gitignore
Browse files
start.sh
CHANGED
|
@@ -2,22 +2,29 @@
|
|
| 2 |
|
| 3 |
echo "π Activating Quantum-API Startup"
|
| 4 |
|
| 5 |
-
# Start FastAPI
|
| 6 |
-
echo "π Starting FastAPI on port 7860..."
|
| 7 |
uvicorn api.main:app --host 0.0.0.0 --port 7860 &> fastapi.log &
|
| 8 |
|
| 9 |
-
#
|
|
|
|
|
|
|
|
|
|
| 10 |
sleep 3
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
if !
|
| 14 |
echo "β FastAPI failed to start. Logs:"
|
| 15 |
cat fastapi.log
|
| 16 |
exit 1
|
| 17 |
else
|
| 18 |
-
echo "β
FastAPI is running
|
| 19 |
fi
|
| 20 |
|
| 21 |
-
# Start Streamlit
|
| 22 |
-
echo "β¨ Launching Streamlit on port
|
| 23 |
streamlit run app/app.py --server.port 8000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
echo "π Activating Quantum-API Startup"
|
| 4 |
|
| 5 |
+
# Start FastAPI in background on port 7860
|
| 6 |
+
echo "π Starting FastAPI (API backend) on port 7860..."
|
| 7 |
uvicorn api.main:app --host 0.0.0.0 --port 7860 &> fastapi.log &
|
| 8 |
|
| 9 |
+
# Capture PID for later kill
|
| 10 |
+
FASTAPI_PID=$!
|
| 11 |
+
|
| 12 |
+
# Wait a bit to ensure it starts
|
| 13 |
sleep 3
|
| 14 |
|
| 15 |
+
# Check if FastAPI is running
|
| 16 |
+
if ! ps -p $FASTAPI_PID > /dev/null; then
|
| 17 |
echo "β FastAPI failed to start. Logs:"
|
| 18 |
cat fastapi.log
|
| 19 |
exit 1
|
| 20 |
else
|
| 21 |
+
echo "β
FastAPI is running as PID $FASTAPI_PID"
|
| 22 |
fi
|
| 23 |
|
| 24 |
+
# Start Streamlit in foreground (required by Hugging Face)
|
| 25 |
+
echo "β¨ Launching Streamlit frontend on port 7860 (Hugging Face expects this)..."
|
| 26 |
streamlit run app/app.py --server.port 8000
|
| 27 |
+
|
| 28 |
+
# Optional cleanup
|
| 29 |
+
echo "π§Ή Shutting down FastAPI PID $FASTAPI_PID..."
|
| 30 |
+
kill $FASTAPI_PID
|