Spaces:
Running
Running
File size: 845 Bytes
c99ff36 bfd16c0 c99ff36 | 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 | import subprocess
import time
import sys
import os
# Force Python to not buffer output
os.environ["PYTHONUNBUFFERED"] = "1"
print("🚀 [Orchestrator] Starting FastAPI backend on port 8000...", flush=True)
backend = subprocess.Popen([sys.executable, "-m", "uvicorn", "api.main:app", "--host", "127.0.0.1", "--port", "8000"])
print("⏳ [Orchestrator] Waiting 10 seconds for ML models to load...", flush=True)
time.sleep(10)
print("🎨 [Orchestrator] Starting Streamlit frontend with CORS/XSRF bypassed...", flush=True)
frontend = subprocess.Popen([
sys.executable, "-m", "streamlit", "run", "frontend/app.py",
"--server.port", "7860",
"--server.address", "0.0.0.0",
"--server.enableCORS=false",
"--server.enableXsrfProtection=false"
])
# Keep the container running by waiting for the frontend process
frontend.wait() |