Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,36 @@
|
|
1 |
# app.py
|
2 |
|
3 |
import gradio as gr
|
4 |
-
from multi_inference import multi_query as deepseek_query
|
5 |
-
|
6 |
from agents.philosopher import PhilosopherAgent
|
7 |
from agents.historian import HistorianAgent
|
8 |
from agents.hacker import HackerAgent
|
9 |
from agents.comedian import ComedianAgent
|
|
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
-
# Chat function
|
18 |
def chat(prompt):
|
19 |
responses = {}
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
return responses
|
25 |
|
26 |
-
|
27 |
-
demo = gr.Interface(
|
28 |
fn=chat,
|
29 |
-
inputs=gr.Textbox(label="Ask
|
30 |
-
outputs=
|
31 |
-
title="
|
32 |
-
description="
|
33 |
)
|
34 |
|
35 |
-
|
36 |
-
if __name__ == "__main__":
|
37 |
-
demo.launch()
|
|
|
1 |
# app.py
|
2 |
|
3 |
import gradio as gr
|
|
|
|
|
4 |
from agents.philosopher import PhilosopherAgent
|
5 |
from agents.historian import HistorianAgent
|
6 |
from agents.hacker import HackerAgent
|
7 |
from agents.comedian import ComedianAgent
|
8 |
+
from agents.base_agent import ACPMessage
|
9 |
|
10 |
+
# Instantiate agents
|
11 |
+
agents = [
|
12 |
+
PhilosopherAgent(),
|
13 |
+
HistorianAgent(),
|
14 |
+
HackerAgent(),
|
15 |
+
ComedianAgent()
|
16 |
+
]
|
17 |
|
|
|
18 |
def chat(prompt):
|
19 |
responses = {}
|
20 |
+
for agent in agents:
|
21 |
+
try:
|
22 |
+
output = agent.generate([ACPMessage(role="user", content=prompt)])
|
23 |
+
except Exception as e:
|
24 |
+
output = f"[ERROR] {e}"
|
25 |
+
responses[agent.name] = output
|
26 |
return responses
|
27 |
|
28 |
+
iface = gr.Interface(
|
|
|
29 |
fn=chat,
|
30 |
+
inputs=gr.Textbox(label="Ask Something", lines=3, placeholder="Type your message here..."),
|
31 |
+
outputs="json",
|
32 |
+
title="π€ Multi-Agent Chatroom (Groq Edition)",
|
33 |
+
description="Talk to 4 AI agents at once using free Groq-powered LLaMA3 API."
|
34 |
)
|
35 |
|
36 |
+
iface.launch()
|
|
|
|