Leonydis137 commited on
Commit
13054d7
·
verified ·
1 Parent(s): 199a7fa

Upload 9 files

Browse files
Files changed (2) hide show
  1. api.py +29 -0
  2. requirements.txt +2 -1
api.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from fastapi import FastAPI, Query
3
+ from fastapi.responses import PlainTextResponse
4
+ from agent import run_agent
5
+ from goal_manager import save_goal, list_goals
6
+ from feedback import list_feedback
7
+ import uvicorn
8
+
9
+ app = FastAPI()
10
+
11
+ @app.get("/run_task", response_class=PlainTextResponse)
12
+ def run_task(task: str = Query(..., description="Task for the AI to perform")):
13
+ return run_agent(task)
14
+
15
+ @app.get("/add_goal", response_class=PlainTextResponse)
16
+ def add_goal(goal: str = Query(..., description="New goal for the AI")):
17
+ save_goal(goal)
18
+ return "Goal saved!"
19
+
20
+ @app.get("/goals", response_class=PlainTextResponse)
21
+ def show_goals():
22
+ return list_goals()
23
+
24
+ @app.get("/feedback", response_class=PlainTextResponse)
25
+ def show_feedback():
26
+ return list_feedback()
27
+
28
+ if __name__ == "__main__":
29
+ uvicorn.run("api:app", host="0.0.0.0", port=7861)
requirements.txt CHANGED
@@ -1 +1,2 @@
1
- gradio
 
 
1
+
2
+ gradio>=3.41.0