Spaces:
Sleeping
Sleeping
# 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() | |