Spaces:
Sleeping
Sleeping
Download server/main.py from prashantmatlani/csa01: direct link, hf CLI and curl.
- Browser
- Download file 734 Bytes
-
https://huggingface.co/spaces/prashantmatlani/csa01/resolve/main/server/main.py
- Command line
-
hf download hf://spaces/prashantmatlani/csa01/server/main.py
-
curl -L -o main.py https://huggingface.co/spaces/prashantmatlani/csa01/resolve/main/server/main.py
734 Bytes
| # server/main.py | |
| from fastapi import FastAPI | |
| from app.env import CustomerSupportEnv | |
| import sys | |
| import os | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) | |
| app = FastAPI() | |
| env = CustomerSupportEnv() | |
| def reset(): | |
| return env.reset() | |
| """ | |
| @app.post("/step") | |
| def step(action: dict): | |
| return env.step(action) | |
| """ | |
| def step(action: dict): | |
| obs, reward, done, info = env.step(action) | |
| return { | |
| "observation": obs, | |
| "reward": reward, | |
| "done": done, | |
| "info": info | |
| } | |
| def state(): | |
| return env.state() | |
| def health(): | |
| return {"status": "ok"} |