Update app.py
Browse files
app.py
CHANGED
@@ -1,35 +1,40 @@
|
|
1 |
# app.py
|
2 |
|
|
|
3 |
import gradio as gr
|
4 |
-
|
5 |
-
multi_inference import multi_query as deepseek_query in app.py
|
6 |
|
7 |
from agents.philosopher import PhilosopherAgent
|
8 |
from agents.historian import HistorianAgent
|
9 |
from agents.hacker import HackerAgent
|
10 |
from agents.comedian import ComedianAgent
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
# Main chat function
|
21 |
def chat(prompt):
|
22 |
-
responses =
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
30 |
fn=chat,
|
31 |
-
inputs="
|
32 |
-
outputs="
|
33 |
-
title="
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# app.py
|
2 |
|
3 |
+
from fastapi import FastAPI
|
4 |
import gradio as gr
|
5 |
+
from multi_inference import multi_query as deepseek_query # β
Corrected import
|
|
|
6 |
|
7 |
from agents.philosopher import PhilosopherAgent
|
8 |
from agents.historian import HistorianAgent
|
9 |
from agents.hacker import HackerAgent
|
10 |
from agents.comedian import ComedianAgent
|
11 |
|
12 |
+
app = FastAPI()
|
13 |
+
|
14 |
+
philosopher = PhilosopherAgent()
|
15 |
+
historian = HistorianAgent()
|
16 |
+
hacker = HackerAgent()
|
17 |
+
comedian = ComedianAgent()
|
18 |
+
|
19 |
|
|
|
20 |
def chat(prompt):
|
21 |
+
responses = {}
|
22 |
+
responses["π§ββοΈ Philosopher"] = philosopher.run(prompt, deepseek_query)
|
23 |
+
responses["π¨βπ« Historian"] = historian.run(prompt, deepseek_query)
|
24 |
+
responses["π» Hacker"] = hacker.run(prompt, deepseek_query)
|
25 |
+
responses["π Comedian"] = comedian.run(prompt, deepseek_query)
|
26 |
+
return responses
|
27 |
+
|
28 |
+
|
29 |
+
interface = gr.Interface(
|
30 |
fn=chat,
|
31 |
+
inputs=gr.Textbox(label="Ask a Question"),
|
32 |
+
outputs=gr.JSON(label="Responses from Agents"),
|
33 |
+
title="Multi-Agent AI Chatroom π€",
|
34 |
+
)
|
35 |
+
|
36 |
+
@app.get("/")
|
37 |
+
def read_root():
|
38 |
+
return {"message": "Welcome to the Multi-Agent AI Chatroom!"}
|
39 |
+
|
40 |
+
app = gr.mount_gradio_app(app, interface, path="/chat")
|