tonko22's picture
refactor: decompose monolithic app into modular architecture
ce0ec3b
raw
history blame
1.54 kB
#!/usr/bin/env python3
"""
Lyrics Analyzer Agent - Main Entry Point
This module serves as the entry point for the Lyrics Analyzer application, which
uses a system of specialized agents to search for and analyze song lyrics.
"""
from loguru import logger
from Gradio_UI import GradioUI
from smolagents import LiteLLMModel
from config import setup_logger, load_api_keys, get_model_id, GRADIO_CONFIG
from agents.manager_agent import create_manager_agent
def main():
"""
Main function to initialize and run the Lyrics Analyzer Agent.
This function sets up logging, loads API keys, initializes the LLM model,
and starts the Gradio UI server with the manager agent.
"""
# Setup logger and API keys
setup_logger()
load_api_keys()
# Initialize the LLM model based on configuration
model_id = get_model_id()
logger.info(f"Initializing with model: {model_id}")
model = LiteLLMModel(model_id=model_id)
# Create the manager agent which will create and manage the other agents
manager_agent = create_manager_agent(model)
# Start the Gradio UI server
logger.info("Initializing Gradio UI and launching server")
GradioUI(manager_agent).launch(
debug=GRADIO_CONFIG['debug'],
share=GRADIO_CONFIG['share'],
server_name=GRADIO_CONFIG['server_name'],
server_port=GRADIO_CONFIG['server_port']
)
logger.success("Server started successfully")
# Run the application when executed directly
if __name__ == "__main__":
main()