Spaces:
Sleeping
Sleeping
Commit ·
7c8585e
1
Parent(s): b9894dd
final fix: openenv schema compliance
Browse files- server7860.py +13 -8
server7860.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
|
| 2 |
-
#
|
| 3 |
|
| 4 |
from fastapi import FastAPI
|
| 5 |
from pydantic import BaseModel
|
|
@@ -43,9 +43,14 @@ def parse_action(action_str: str):
|
|
| 43 |
|
| 44 |
@app.post("/reset")
|
| 45 |
def reset():
|
| 46 |
-
|
| 47 |
-
return
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
@app.post("/step")
|
| 51 |
def step(req: StepRequest):
|
|
@@ -55,8 +60,8 @@ def step(req: StepRequest):
|
|
| 55 |
obs, reward, done, info = env.step(action_dict)
|
| 56 |
|
| 57 |
return {
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
}
|
|
|
|
| 1 |
|
| 2 |
+
# server7860.py
|
| 3 |
|
| 4 |
from fastapi import FastAPI
|
| 5 |
from pydantic import BaseModel
|
|
|
|
| 43 |
|
| 44 |
@app.post("/reset")
|
| 45 |
def reset():
|
| 46 |
+
state = env.reset()
|
| 47 |
+
return {
|
| 48 |
+
"state": state,
|
| 49 |
+
"reward": 0,
|
| 50 |
+
"done": False,
|
| 51 |
+
"info": {}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
|
| 55 |
@app.post("/step")
|
| 56 |
def step(req: StepRequest):
|
|
|
|
| 60 |
obs, reward, done, info = env.step(action_dict)
|
| 61 |
|
| 62 |
return {
|
| 63 |
+
"state": obs,
|
| 64 |
+
"reward": reward,
|
| 65 |
+
"done": done,
|
| 66 |
+
"info": {}
|
| 67 |
}
|