OmarGamal48812 commited on
Commit
a988b9a
·
verified ·
1 Parent(s): 9b1a9eb

Upload start.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. start.sh +22 -0
start.sh ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Start FastAPI in background
3
+ python -m uvicorn src.api.main:app --host 0.0.0.0 --port 8000 &
4
+
5
+ # Wait for FastAPI to be ready
6
+ echo "Waiting for FastAPI to start..."
7
+ for i in $(seq 1 30); do
8
+ if python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" 2>/dev/null; then
9
+ echo "FastAPI is ready!"
10
+ break
11
+ fi
12
+ sleep 1
13
+ done
14
+
15
+ # Start Dash on port 7860 (HF Spaces expects this port)
16
+ python -c "
17
+ import sys, os
18
+ sys.path.insert(0, '/app')
19
+ os.chdir('/app')
20
+ from dashboards.dash_app.app import app
21
+ app.run(host='0.0.0.0', port=7860, debug=False)
22
+ "