mcp2-backend / app.py
aymnsk's picture
Update app.py
7337f9c verified
raw
history blame
951 Bytes
# app.py
import gradio as gr
from agents.philosopher import PhilosopherAgent
from agents.historian import HistorianAgent
from agents.hacker import HackerAgent
from agents.comedian import ComedianAgent
from agents.base_agent import ACPMessage
# Instantiate agents
agents = [
PhilosopherAgent(),
HistorianAgent(),
HackerAgent(),
ComedianAgent()
]
def chat(prompt):
responses = {}
for agent in agents:
try:
output = agent.generate([ACPMessage(role="user", content=prompt)])
except Exception as e:
output = f"[ERROR] {e}"
responses[agent.name] = output
return responses
iface = gr.Interface(
fn=chat,
inputs=gr.Textbox(label="Ask Something", lines=3, placeholder="Type your message here..."),
outputs="json",
title="🤖 Multi-Agent Chatroom (Groq Edition)",
description="Talk to 4 AI agents at once using free Groq-powered LLaMA3 API."
)
iface.launch()