Spaces:
Running
Running
Download openenv/berth_openenv/explorer.py from FineEnvs/PortSimEnv: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/spaces/FineEnvs/PortSimEnv/resolve/main/openenv/berth_openenv/explorer.py
- Command line
-
hf download hf://spaces/FineEnvs/PortSimEnv/openenv/berth_openenv/explorer.py
-
curl -L -o explorer.py https://huggingface.co/spaces/FineEnvs/PortSimEnv/resolve/main/openenv/berth_openenv/explorer.py
1.32 kB
| """The eval explorer (the FineEnvs/PortSimEnv-Eval Space): the viewer and its read-only JSON, without an environment. | |
| Overview with the eval table, tasks, task pages and model rollouts replayed in 3D, from the task packs | |
| (BERTH_TASKS_DIR) and the rollouts under BERTH_RUNS_DIR. No OpenEnv sessions, no /ws, no live episodes; the viewer | |
| runs in explorer mode, so playing an episode links to the environment Space (BERTH_PLAY_URL). | |
| BERTH_RUNS_DIR=results/rollouts uvicorn berth_openenv.explorer:app --port 8000 -> /viewer/ | |
| """ | |
| from __future__ import annotations | |
| import os | |
| from fastapi import FastAPI | |
| from fastapi.responses import RedirectResponse | |
| from berth_core import load_pack | |
| try: | |
| from .api import mount_viewer | |
| except ImportError: | |
| from api import mount_viewer | |
| def create_app() -> FastAPI: | |
| pack = load_pack() | |
| app = FastAPI(title="PortSimEnv v1 eval", description="Read-only eval explorer for PortSimEnv v1.") | |
| mount_viewer(app, pack, mode=os.environ.get("BERTH_VIEWER_MODE") or "explorer") | |
| def healthz(): | |
| return {"status": "ok", "tasks": {s: pack.count(s) for s in pack.splits()}} | |
| def root(): | |
| return RedirectResponse("/viewer/") | |
| return app | |
| app = create_app() | |