abdullah-113 commited on
Commit
c99ff36
·
verified ·
1 Parent(s): e8e640f

Create start.py

Browse files
Files changed (1) hide show
  1. start.py +19 -0
start.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import time
3
+ import sys
4
+ import os
5
+
6
+ # Force Python to not buffer output
7
+ os.environ["PYTHONUNBUFFERED"] = "1"
8
+
9
+ print("🚀 [Orchestrator] Starting FastAPI backend on port 8000...", flush=True)
10
+ backend = subprocess.Popen([sys.executable, "-m", "uvicorn", "api.main:app", "--host", "127.0.0.1", "--port", "8000"])
11
+
12
+ print("⏳ [Orchestrator] Waiting 10 seconds for ML models to load...", flush=True)
13
+ time.sleep(10)
14
+
15
+ print("🎨 [Orchestrator] Starting Streamlit frontend on port 7860...", flush=True)
16
+ frontend = subprocess.Popen([sys.executable, "-m", "streamlit", "run", "frontend/app.py", "--server.port", "7860", "--server.address", "0.0.0.0"])
17
+
18
+ # Keep the container running by waiting for the frontend process
19
+ frontend.wait()