Spaces:
Sleeping
Sleeping
Download server.py from wysh3/oversightforge-2: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/wysh3/oversightforge-2/resolve/main/server.py
- Command line
-
hf download hf://spaces/wysh3/oversightforge-2/server.py
-
curl -L -o server.py https://huggingface.co/spaces/wysh3/oversightforge-2/resolve/main/server.py
1.08 kB
| """ | |
| Combined server for HuggingFace Spaces deployment. | |
| Serves both the OversightForge environment API (for training) and the | |
| dashboard UI (for live demo) on a single port (7860). | |
| Environment API endpoints: /reset, /step, /state, /health, /reset_eval | |
| Dashboard endpoints: /dashboard, /dashboard/events, /dashboard/state | |
| Dashboard UI: / (root shows the dashboard) | |
| """ | |
| import sys | |
| import os | |
| # Add the app directory to the path so imports work | |
| sys.path.insert(0, "/app/environment") | |
| sys.path.insert(0, "/app/dashboard") | |
| from fastapi import FastAPI | |
| from fastapi.responses import HTMLResponse | |
| # Import both apps | |
| from environment.app.main import app as env_app | |
| from dashboard.app.main import app as dash_app, index as dashboard_index | |
| # Use the environment app as the base so all its routes work natively | |
| app = env_app | |
| app.title = "OversightForge 2.0" | |
| app.version = "2.0.0" | |
| # Mount the dashboard at /dashboard | |
| app.mount("/dashboard", dash_app) | |
| def root(): | |
| """Root page — show the dashboard directly.""" | |
| return dashboard_index() | |