Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,3 +62,35 @@ demo = gr.ChatInterface(
|
|
| 62 |
|
| 63 |
if __name__ == "__main__":
|
| 64 |
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
if __name__ == "__main__":
|
| 64 |
demo.launch()
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
# Import necessary libraries
|
| 68 |
+
import random
|
| 69 |
+
from smolagents import CodeAgent, InferenceClientModel
|
| 70 |
+
|
| 71 |
+
# Import our custom tools from their modules
|
| 72 |
+
from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool
|
| 73 |
+
from retriever import load_guest_dataset
|
| 74 |
+
|
| 75 |
+
# Initialize the Hugging Face model
|
| 76 |
+
model = InferenceClientModel()
|
| 77 |
+
|
| 78 |
+
# Initialize the web serarch tool
|
| 79 |
+
search_tool = DuckDuckGoSearchTool()
|
| 80 |
+
|
| 81 |
+
# Initialize the weather tool
|
| 82 |
+
weather_info_tool = WeatherInfoTool()
|
| 83 |
+
|
| 84 |
+
# Initialize the Hub stats tool
|
| 85 |
+
hub_stats_tool = HubStatsTool()
|
| 86 |
+
|
| 87 |
+
# Load the guest dataset and initialize the guest info tool
|
| 88 |
+
guest_info_tool = load_guest_dataset()
|
| 89 |
+
|
| 90 |
+
# Create Alfred with all the tools
|
| 91 |
+
alfred = CodeAgent(
|
| 92 |
+
tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool],
|
| 93 |
+
model=model,
|
| 94 |
+
add_base_tools=True, # Add any additional base tools
|
| 95 |
+
planning_interval=3 # Enable planning every 3 steps
|
| 96 |
+
)
|