qwikQ8 commited on
Commit
aa9257e
·
verified ·
1 Parent(s): 86e0897

Create app3.py

Browse files

https://huggingface.co/spaces/agents-course/Unit_3_Agentic_RAG/tree/main

Maybe don't call GradioUI but instead input into original assignment with base definitions.

Files changed (1) hide show
  1. app3.py +34 -0
app3.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ tools=[weather_info_tool, search_tool],
28
+ model=model,
29
+ add_base_tools=True, # Add any additional base tools
30
+ planning_interval=3 # Enable planning every 3 steps
31
+ )
32
+
33
+ if __name__ == "__main__":
34
+ GradioUI(alfred).launch()