Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# app.py
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
from inference import 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 |
+
# Load agents
|
12 |
+
agents = [
|
13 |
+
PhilosopherAgent(),
|
14 |
+
HistorianAgent(),
|
15 |
+
HackerAgent(),
|
16 |
+
ComedianAgent()
|
17 |
+
]
|
18 |
+
|
19 |
+
# Main chat function
|
20 |
+
def chat(prompt):
|
21 |
+
responses = []
|
22 |
+
for agent in agents:
|
23 |
+
reply = agent.generate_response(prompt, deepseek_query)
|
24 |
+
responses.append(f"{agent.name}: {reply.strip()}")
|
25 |
+
return "\n\n".join(responses)
|
26 |
+
|
27 |
+
# Gradio UI
|
28 |
+
gr.Interface(
|
29 |
+
fn=chat,
|
30 |
+
inputs="text",
|
31 |
+
outputs="text",
|
32 |
+
title="🧠 Multi-Agent AI Chatroom",
|
33 |
+
description="Talk to a Philosopher, Historian, Hacker, and Comedian — all at once!"
|
34 |
+
).launch()
|