Spaces:
Running
Running
| 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() |