Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,11 +8,13 @@ from agents.historian import HistorianAgent
|
|
| 8 |
from agents.hacker import HackerAgent
|
| 9 |
from agents.comedian import ComedianAgent
|
| 10 |
|
|
|
|
| 11 |
philosopher = PhilosopherAgent()
|
| 12 |
historian = HistorianAgent()
|
| 13 |
hacker = HackerAgent()
|
| 14 |
comedian = ComedianAgent()
|
| 15 |
|
|
|
|
| 16 |
def chat(prompt):
|
| 17 |
responses = {}
|
| 18 |
responses["🧙♂️ Philosopher"] = philosopher.run(prompt, deepseek_query)
|
|
@@ -21,12 +23,15 @@ def chat(prompt):
|
|
| 21 |
responses["🎭 Comedian"] = comedian.run(prompt, deepseek_query)
|
| 22 |
return responses
|
| 23 |
|
|
|
|
| 24 |
demo = gr.Interface(
|
| 25 |
fn=chat,
|
| 26 |
inputs=gr.Textbox(label="Ask a Question"),
|
| 27 |
-
outputs=gr.JSON(label="Responses
|
| 28 |
-
title="Multi-Agent AI Chatroom
|
|
|
|
| 29 |
)
|
| 30 |
|
|
|
|
| 31 |
if __name__ == "__main__":
|
| 32 |
demo.launch()
|
|
|
|
| 8 |
from agents.hacker import HackerAgent
|
| 9 |
from agents.comedian import ComedianAgent
|
| 10 |
|
| 11 |
+
# Initialize agent classes
|
| 12 |
philosopher = PhilosopherAgent()
|
| 13 |
historian = HistorianAgent()
|
| 14 |
hacker = HackerAgent()
|
| 15 |
comedian = ComedianAgent()
|
| 16 |
|
| 17 |
+
# Chat function
|
| 18 |
def chat(prompt):
|
| 19 |
responses = {}
|
| 20 |
responses["🧙♂️ Philosopher"] = philosopher.run(prompt, deepseek_query)
|
|
|
|
| 23 |
responses["🎭 Comedian"] = comedian.run(prompt, deepseek_query)
|
| 24 |
return responses
|
| 25 |
|
| 26 |
+
# Gradio UI setup
|
| 27 |
demo = gr.Interface(
|
| 28 |
fn=chat,
|
| 29 |
inputs=gr.Textbox(label="Ask a Question"),
|
| 30 |
+
outputs=gr.JSON(label="Agent Responses"),
|
| 31 |
+
title="🧠 Multi-Agent AI Chatroom",
|
| 32 |
+
description="Ask anything. Each AI agent gives a unique answer!"
|
| 33 |
)
|
| 34 |
|
| 35 |
+
# Only launch if run directly (used by Hugging Face too)
|
| 36 |
if __name__ == "__main__":
|
| 37 |
demo.launch()
|