Spaces:
Sleeping
Sleeping
Download server/app.py from MazeRunner1531/code-review-env: direct link, hf CLI and curl.
- Browser
- Download file 631 Bytes
-
https://huggingface.co/spaces/MazeRunner1531/code-review-env/resolve/main/server/app.py
- Command line
-
hf download hf://spaces/MazeRunner1531/code-review-env/server/app.py
-
curl -L -o app.py https://huggingface.co/spaces/MazeRunner1531/code-review-env/resolve/main/server/app.py
631 Bytes
| from fastapi import FastAPI | |
| from env.env import CodeReviewEnv | |
| from env.models import Action | |
| import uvicorn | |
| app = FastAPI() | |
| env = CodeReviewEnv() | |
| def reset(): | |
| obs = env.reset() | |
| return obs.dict() | |
| def step(action: dict): | |
| act = Action(**action) | |
| obs, reward, done, info = env.step(act) | |
| return { | |
| "observation": obs.dict(), | |
| "reward": reward, | |
| "done": done, | |
| "info": info | |
| } | |
| def root(): | |
| return {"status": "ok"} | |
| def main(): | |
| uvicorn.run("server.app:app", host="0.0.0.0", port=7860) | |
| if __name__ == "__main__": | |
| main() |