gkmgarcia's picture
Update app.py
832f827 verified
from smolagents import CodeAgent, HfApiModel
# Initialize the Hugging Face model
model = HfApiModel()
# Create Alfred, our gala agent, with the guest info tool
alfred = CodeAgent(tools=[guest_info_tool], model=model)
# Example query Alfred might receive during the gala
response = alfred.run("Tell me about our guest named 'Lady Ada Lovelace'.")
print("🎩 Alfred's Response:")
print(response)
'''
import gradio as gr
import random
from smolagents import GradioUI, CodeAgent, HfApiModel
# Import our custom tools from their modules
from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool
from retriever import load_guest_dataset
# Initialize the Hugging Face model
model = HfApiModel()
# Initialize the web search tool
search_tool = DuckDuckGoSearchTool()
# Initialize the weather tool
weather_info_tool = WeatherInfoTool()
# Initialize the Hub stats tool
hub_stats_tool = HubStatsTool()
# Load the guest dataset and initialize the guest info tool
guest_info_tool = load_guest_dataset()
# Create Alfred with all the tools
alfred = CodeAgent(
tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool],
model=model,
add_base_tools=True, # Add any additional base tools
planning_interval=3 # Enable planning every 3 steps
)
if __name__ == "__main__":
GradioUI(alfred).launch()
'''