Spaces:
Sleeping
Sleeping
Update app.py
Browse filesCreate agent with model and tools
app.py
CHANGED
|
@@ -16,7 +16,8 @@ from smolagents import CodeAgent, HfApiModel, DuckDuckGoSearchTool, VisitWebpage
|
|
| 16 |
# openai.api_key = ('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')
|
| 17 |
# GoogleSearch.SERP_API_KEY = 'a2fa0feab384c372147075f190fe5878300bbbb693eb0aced535e5d58189ad70'
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
# (Keep Constants as is)
|
| 22 |
# --- Constants ---
|
|
@@ -54,7 +55,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 54 |
|
| 55 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 56 |
try:
|
| 57 |
-
agent =
|
| 58 |
except Exception as e:
|
| 59 |
print(f"Error instantiating agent: {e}")
|
| 60 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 16 |
# openai.api_key = ('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')
|
| 17 |
# GoogleSearch.SERP_API_KEY = 'a2fa0feab384c372147075f190fe5878300bbbb693eb0aced535e5d58189ad70'
|
| 18 |
|
| 19 |
+
# Create model
|
| 20 |
+
model = HfApiModel()
|
| 21 |
|
| 22 |
# (Keep Constants as is)
|
| 23 |
# --- Constants ---
|
|
|
|
| 55 |
|
| 56 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 57 |
try:
|
| 58 |
+
agent = CodeAgent(tools=[DuckDuckGoSearchTool(), VisitWebpageTool(), PythonInterpreterTool(), SpeechToTextTool()], model=model)
|
| 59 |
except Exception as e:
|
| 60 |
print(f"Error instantiating agent: {e}")
|
| 61 |
return f"Error initializing agent: {e}", None
|