Spaces:
Paused
Paused
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import random
|
3 |
+
from smolagents import GradioUI, CodeAgent, HfApiModel
|
4 |
+
|
5 |
+
# Import our custom tools from their modules
|
6 |
+
from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool
|
7 |
+
from retriever import load_guest_dataset
|
8 |
+
|
9 |
+
# Initialize the Hugging Face model
|
10 |
+
model = HfApiModel()
|
11 |
+
|
12 |
+
# Initialize the web search tool
|
13 |
+
search_tool = DuckDuckGoSearchTool()
|
14 |
+
|
15 |
+
# Initialize the weather tool
|
16 |
+
weather_info_tool = WeatherInfoTool()
|
17 |
+
|
18 |
+
# Initialize the Hub stats tool
|
19 |
+
hub_stats_tool = HubStatsTool()
|
20 |
+
|
21 |
+
# Load the guest dataset and initialize the guest info tool
|
22 |
+
guest_info_tool = load_guest_dataset()
|
23 |
+
|
24 |
+
# Create Alfred with all the tools
|
25 |
+
alfred = CodeAgent(
|
26 |
+
tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool],
|
27 |
+
model=model,
|
28 |
+
add_base_tools=True, # Add any additional base tools
|
29 |
+
planning_interval=3 # Enable planning every 3 steps
|
30 |
+
)
|
31 |
+
|
32 |
+
if __name__ == "__main__":
|
33 |
+
GradioUI(alfred).launch()
|