Spaces:
Runtime error
Runtime error
| # app.py - Clean version | |
| import gradio as gr | |
| from smolagents import GradioUI, CodeAgent, InferenceClientModel | |
| # Import our custom tools | |
| from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool | |
| from retriever import load_guest_dataset | |
| # Initialize | |
| model = InferenceClientModel() # Updated | |
| search_tool = DuckDuckGoSearchTool() | |
| weather_info_tool = WeatherInfoTool() | |
| hub_stats_tool = HubStatsTool() | |
| guest_tool = load_guest_dataset() | |
| # Enhance tool descriptions | |
| guest_tool.description = "USE THIS FOR GALA GUESTS! Database with names, relations, descriptions, emails of attendees. Examples: 'Lady Ada Lovelace', 'guest list', 'who is coming'. NEVER use web search for guests." | |
| # Create agent | |
| alfred = CodeAgent( | |
| tools=[guest_tool, weather_info_tool, hub_stats_tool, search_tool], | |
| model=model, | |
| add_base_tools=True, | |
| planning_interval=3 | |
| ) | |
| if __name__ == "__main__": | |
| # Quick test | |
| print("Testing...") | |
| response = alfred.run("Tell me about Lady Ada Lovelace at the gala") | |
| print(f"Response: {response[:300]}...") | |
| # Launch UI | |
| GradioUI(alfred).launch() |