subatomicERROR commited on
Commit
16c76cc
Β·
1 Parent(s): e5cc10e

πŸ”§ Make start.sh Hugging Face-compatible and update .gitignore

Browse files
Files changed (1) hide show
  1. start.sh +15 -8
start.sh CHANGED
@@ -2,22 +2,29 @@
2
 
3
  echo "πŸš€ Activating Quantum-API Startup"
4
 
5
- # Start FastAPI (api.main:app) on port 7860
6
- echo "πŸŒ€ Starting FastAPI on port 7860..."
7
  uvicorn api.main:app --host 0.0.0.0 --port 7860 &> fastapi.log &
8
 
9
- # Wait 3 seconds
 
 
 
10
  sleep 3
11
 
12
- # Show FastAPI logs if it failed
13
- if ! pgrep -f "uvicorn api.main:app" > /dev/null; then
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 app on port 8000
22
- echo "✨ Launching Streamlit on port 8000..."
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