vedantdere commited on
Commit
2d0cef4
·
1 Parent(s): 213c258

added support for websearch agent

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import CodeAgent, WebSearchTool, InferenceClientModel, GradioUI
2
+ from smolagents import OpenAIServerModel
3
+
4
+
5
+
6
+ # Create the model instance using Gemini API
7
+ model = InferenceClientModel()
8
+
9
+ # Create the CodeAgent with WebSearchTool
10
+ agent = CodeAgent(
11
+ tools=[WebSearchTool()],
12
+ model=model,
13
+ stream_outputs=True
14
+ )
15
+
16
+ # Wrap the agent in the HuggingFace Chat UI
17
+ ui = GradioUI(agent=agent)
18
+
19
+ # Launch the UI
20
+ if __name__ == "__main__":
21
+ ui.launch()