Spaces:
Runtime error
Runtime error
| """FastAPI application for the SimLab HR OpenEnv environment.""" | |
| from pathlib import Path | |
| from fastapi import FastAPI | |
| from fastapi.responses import HTMLResponse | |
| from openenv.core.env_server import create_app | |
| from simlab_hr.models import HRAction, HRObservation | |
| from simlab_hr.server.environment import HREnvironment | |
| _openenv_app = create_app(HREnvironment, HRAction, HRObservation, env_name="simlab-hr") | |
| app = FastAPI(title="SimLab HR") | |
| _landing_html = None | |
| _landing_path = Path(__file__).resolve().parent.parent / "landing.py" | |
| if _landing_path.exists(): | |
| _ns = {} | |
| exec(compile(_landing_path.read_text(), _landing_path, "exec"), _ns) | |
| _landing_html = _ns.get("LANDING_HTML") | |
| async def landing_page(): | |
| if _landing_html: | |
| return _landing_html | |
| return '<h1>SimLab HR</h1><p><a href="/api/docs">API Docs</a></p>' | |
| app.mount("/api", _openenv_app) | |