-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
52 lines (37 loc) · 1.54 KB
/
main.py
File metadata and controls
52 lines (37 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
import gradio as gr
from dotenv import load_dotenv
from multiagents.agent import MultiAgentTeam
from multiagents.db.database import init_database
from multiagents.db.models import Customer
from multiagents.utils import logger
log = logger.get_logger(__name__)
log = logger.init(level="DEBUG", save_log=True)
_ = load_dotenv()
UI_PORT: int = int(os.getenv("UI_PORT", "8046"))
DATABASE_URL = os.getenv("DATABASE_URL")
PLACE_HOLDER = "¡Hola! ¿En qué puedo ayudarte?"
BOTH_ICON = "app/assets/bot.png"
USER_ICON = "app/assets/user.png"
# Initialize the agents
multi_agent_team = MultiAgentTeam()
def respond(question, history):
""" Respond to user input. """
return multi_agent_team.request(question)
chatbot = gr.ChatInterface(
fn=respond,
type="messages",
chatbot=gr.Chatbot(elem_id="chatbot", height="auto", avatar_images=[USER_ICON, BOTH_ICON]),
title="Team Leader Agent with Agno",
textbox=gr.Textbox(placeholder=PLACE_HOLDER, container=False, scale=7),
submit_btn="Enviar",
theme=gr.themes.Default(primary_hue="pink", secondary_hue="pink"),
examples=["What is the latest news?", "Who is Thomas Edison?", "How do I make chicken and galangal in coconut milk soup"],
)
if __name__ == "__main__":
# session = init_database()
# customers = session.query(Customer).all()
# for customer in customers:
# print(customer.FirstName, customer.LastName, customer.Email)
log.info("Starting UI...")
chatbot.launch(server_port=UI_PORT)