Spaces:
Sleeping
Sleeping
File size: 1,001 Bytes
2de3485 b7bab2b f131c3c 2de3485 7d002aa 0bbdc65 1650058 2de3485 b7bab2b 1650058 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from openenv.core.env_server import create_fastapi_app
from .cloud_audit_env import CloudAuditEnv
from models import CloudAction, CloudObservation
# The create_fastapi_app helper wraps the Environment class into a FastAPI app
# that exposes /reset, /step, and /state endpoints.
app = create_fastapi_app(
env=CloudAuditEnv,
action_cls=CloudAction,
observation_cls=CloudObservation
)
@app.post("/reset")
async def reset_with_task(task_name: str = "easy_audit"):
# Access the shared environment instance created by create_fastapi_app
# Note: create_fastapi_app typically stores the env instance in app.state.env
env = app.state.env
obs = env.reset(task_name=task_name)
return obs.model_dump()
def main():
import uvicorn
print("[DEBUG] Starting Unified CloudAudit Server", flush=True)
# When deployed via entry point, we refer to the module 'server.app:app'
uvicorn.run("server.app:app", host="0.0.0.0", port=7860)
if __name__ == "__main__":
main()
|