Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- server/app.py +3 -2
server/app.py
CHANGED
|
@@ -112,10 +112,11 @@ def web_health() -> Dict[str, str]:
|
|
| 112 |
|
| 113 |
@app.post("/reset", response_model=Observation, summary="Start / restart an episode")
|
| 114 |
@app.post("/web/reset", response_model=Observation, include_in_schema=False)
|
| 115 |
-
def reset(req: ResetRequest) -> Observation:
|
| 116 |
"""Reset the environment for a given task_id (1=easy, 2=medium, 3=hard)."""
|
| 117 |
try:
|
| 118 |
-
|
|
|
|
| 119 |
except ValueError as exc:
|
| 120 |
raise HTTPException(status_code=400, detail=str(exc))
|
| 121 |
return obs
|
|
|
|
| 112 |
|
| 113 |
@app.post("/reset", response_model=Observation, summary="Start / restart an episode")
|
| 114 |
@app.post("/web/reset", response_model=Observation, include_in_schema=False)
|
| 115 |
+
def reset(req: Optional[ResetRequest] = None) -> Observation:
|
| 116 |
"""Reset the environment for a given task_id (1=easy, 2=medium, 3=hard)."""
|
| 117 |
try:
|
| 118 |
+
task_id = req.task_id if req is not None else 1
|
| 119 |
+
obs = _env.reset(task_id=task_id)
|
| 120 |
except ValueError as exc:
|
| 121 |
raise HTTPException(status_code=400, detail=str(exc))
|
| 122 |
return obs
|