File size: 466 Bytes
2d0cef4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from smolagents import CodeAgent, WebSearchTool, InferenceClientModel, GradioUI
from smolagents import OpenAIServerModel



# Create the model instance using Gemini API
model = InferenceClientModel()

# Create the CodeAgent with WebSearchTool
agent = CodeAgent(
    tools=[WebSearchTool()],
    model=model,
    stream_outputs=True
)

# Wrap the agent in the HuggingFace Chat UI
ui = GradioUI(agent=agent)

# Launch the UI
if __name__ == "__main__":
    ui.launch()