renanserrano's picture
Upload folder using huggingface_hub
bd67f06 verified
raw
history blame contribute delete
943 Bytes
"""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")
@app.get("/", response_class=HTMLResponse, include_in_schema=False)
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)