File size: 585 Bytes
8fca47f 30666e7 8fca47f 30666e7 8fca47f 30666e7 8fca47f 30666e7 8fca47f 30666e7 8fca47f 30666e7 8fca47f 30666e7 2e9b6a0 30666e7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | from fastapi import FastAPI
from pydantic import BaseModel
from env import EmailEnv
import uvicorn
app = FastAPI()
env = EmailEnv()
class Action(BaseModel):
label: str
reply: str
@app.post("/reset")
def reset():
return env.reset()
@app.post("/step")
def step(action: Action):
reward = env.step(action.dict())
return {
"reward": reward,
"done": True
}
@app.get("/")
def home():
return {"message": "Email Triage AI Environment Running"}
def main():
uvicorn.run(app, host="0.0.0.0", port=7860)
if __name__ == "__main__":
main() |