#!/usr/bin/env bash # Runs both Papaya processes inside one container. # - FastAPI backend: private, only reachable inside the container (127.0.0.1:8000) # - Streamlit dashboard: public on port 7860 (the port Hugging Face exposes) set -e export PAPAYA_BACKEND_URL="http://127.0.0.1:8000" uvicorn backend.main:app --host 127.0.0.1 --port 8000 & # Wait (max ~30s) until the backend answers before starting the dashboard python - <<'PY' import time, urllib.request for _ in range(60): try: urllib.request.urlopen("http://127.0.0.1:8000/health", timeout=1) break except Exception: time.sleep(0.5) PY exec streamlit run simulator/app_dashboard.py \ --server.port 7860 \ --server.address 0.0.0.0 \ --server.headless true \ --browser.gatherUsageStats false