ekarakatya's picture
Update app.py
0d17f32 verified
Raw
History Blame Contribute Delete
938 Bytes
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, LatestNewsTool
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()
latest_news_tool = LatestNewsTool()
# 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, latest_news_tool],
model=model,
add_base_tools=True,
planning_interval=3
)
if __name__ == "__main__":
GradioUI(alfred).launch()