File size: 803 Bytes
4b35062
 
 
 
16c76cc
 
4b35062
 
16c76cc
 
 
 
4b35062
 
16c76cc
 
4b35062
 
 
 
16c76cc
4b35062
 
16c76cc
 
4b35062
16c76cc
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

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