Spaces:
Sleeping
Sleeping
Lukas Hartrumpf
commited on
Commit
·
5fa92e6
1
Parent(s):
0acfef4
add code agent
Browse files- .gitignore +2 -1
- app.py +7 -2
- requirements.txt +2 -1
.gitignore
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
.env
|
|
|
|
|
|
| 1 |
+
.env
|
| 2 |
+
.venv
|
app.py
CHANGED
|
@@ -3,7 +3,8 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
|
|
|
|
| 7 |
# Test comment
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
|
@@ -42,7 +43,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 42 |
|
| 43 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 44 |
try:
|
| 45 |
-
agent =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
except Exception as e:
|
| 47 |
print(f"Error instantiating agent: {e}")
|
| 48 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
import openai
|
| 7 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIServerModel
|
| 8 |
# Test comment
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
|
|
|
| 43 |
|
| 44 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 45 |
try:
|
| 46 |
+
agent = CodeAgent(
|
| 47 |
+
model=OpenAIServerModel("gpt-4o"),
|
| 48 |
+
tools=[DuckDuckGoSearchTool()],
|
| 49 |
+
verbose=True,
|
| 50 |
+
)
|
| 51 |
except Exception as e:
|
| 52 |
print(f"Error instantiating agent: {e}")
|
| 53 |
return f"Error initializing agent: {e}", None
|
requirements.txt
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
gradio
|
| 2 |
-
requests
|
|
|
|
|
|
| 1 |
gradio
|
| 2 |
+
requests
|
| 3 |
+
smolagents
|