Spaces:
Sleeping
Sleeping
Subhash Vadaparthi commited on
Commit ·
5ee33e9
1
Parent(s): 6062e59
Serve Swagger UI docs at root path for OpenEnv compatibility
Browse files4 unmodified lines56789101112131415161718194 unmodified linesfrom app.models import Action, StepResponse, ResetResponse, StateResponse, TaskResponse, GraderResponse, BaselineResponsefrom typing import List, Dict, Anyapp = FastAPI(title="Healthcare Appointment Scheduling RL Environment")# Global environment instanceenv = HealthcareEnv()@app.get("/")def read_root():return {"message": "Healthcare Appointment Scheduling RL Environment API"}@app.api_route("/reset", methods=["GET", "POST"], response_model=ResetResponse)def reset_env():obs = env.reset()4 unmodified lines567891011121314151617181920212223242526272829303132333435363738394041424344454 unmodified linesfrom app.models import Action, StepResponse, ResetResponse, StateResponse, TaskResponse, GraderResponse, BaselineResponsefrom typing import List, Dict, AnyDESCRIPTION = """## OpenEnv Environment HTTP APIHTTP API for interacting with OpenEnv environments through a standardized interface.### Features- **Environment Reset**: Initialize or restart episodes- **Action Execution**: Send actions and receive observations- **State Inspection**: Query current environment state- **Schema Access**: Retrieve JSON schemas for actions and observations### Workflow1. Call `/reset` to start a new episode and get initial observation2. Call `/step` repeatedly with actions to interact with environment3. Episode ends when observation returns `done: true`4. Call `/state` anytime to inspect current environment state### Documentation- **Swagger UI**: Available at `/docs`- **ReDoc**: Available at `/redoc`- **OpenAPI Schema**: Available at `/openapi.json`[OpenEnv Team - Website](https://openenv.org) | BSD-3-Clause"""app = FastAPI(title="OpenEnv Environment HTTP API",version="1.0.0",description=DESCRIPTION,docs_url="/",)# Global environment instanceenv = HealthcareEnv()@app.api_route("/reset", methods=["GET", "POST"], response_model=ResetResponse)def reset_env():obs = env.reset()
app/main.py+31-5