Spaces:
Runtime error
Runtime error
added tasks endpoints corresponding to the updated yaml and added a corresponding reset point too
Browse files- server/app.py +13 -2
server/app.py
CHANGED
|
@@ -40,8 +40,19 @@ def health():
|
|
| 40 |
|
| 41 |
@app.get("/tasks")
|
| 42 |
def list_tasks():
|
| 43 |
-
return {
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
@app.post("/grader")
|
| 46 |
def grade_episode(request: GraderRequest):
|
| 47 |
# Validate task_id
|
|
|
|
| 40 |
|
| 41 |
@app.get("/tasks")
|
| 42 |
def list_tasks():
|
| 43 |
+
return {
|
| 44 |
+
"tasks": [
|
| 45 |
+
{"id": "task_1", "name": "Single Query Routing", "difficulty": "easy"},
|
| 46 |
+
{"id": "task_2", "Multi-Query Episode", "difficulty": "medium"},
|
| 47 |
+
{"id": "task_3", "Stateful Carbon-Aware Routing", "difficulty": "hard"},
|
| 48 |
+
]
|
| 49 |
+
}
|
| 50 |
+
@app.post("/reset")
|
| 51 |
+
def reset(body: dict = {}):
|
| 52 |
+
task_id = body.get("task_id", "task_1")
|
| 53 |
+
obs = env.reset(task_id=task_id)
|
| 54 |
+
return obs
|
| 55 |
+
|
| 56 |
@app.post("/grader")
|
| 57 |
def grade_episode(request: GraderRequest):
|
| 58 |
# Validate task_id
|