Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import requests
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
import yaml
|
|
|
|
| 7 |
|
| 8 |
# os.system('pip install "smolagents[transformers]"')
|
| 9 |
# os.system('pip install duckduckgo-search')
|
|
@@ -11,12 +12,12 @@ import yaml
|
|
| 11 |
# os.system('pip install openai')
|
| 12 |
|
| 13 |
# Import modules and classes from openai and smolagents
|
| 14 |
-
from smolagents import CodeAgent, HfApiModel, DuckDuckGoSearchTool, VisitWebpageTool
|
| 15 |
# from tools import FinalAnswerTool
|
| 16 |
# from huggingface_hub import login
|
| 17 |
|
| 18 |
# Log in to Hugging Face with API_KEY
|
| 19 |
-
HF_API_KEY = os.getenv("HF_API_KEY")
|
| 20 |
# login(HF_API_KEY)
|
| 21 |
|
| 22 |
# Set API key for OPENAI
|
|
@@ -26,10 +27,10 @@ HF_API_KEY = os.getenv("HF_API_KEY")
|
|
| 26 |
# model = OpenAIServerModel(model_id="gpt-4o")
|
| 27 |
# model = HfApiModel()
|
| 28 |
|
| 29 |
-
model = HfApiModel(
|
| 30 |
-
model_id="Qwen/Qwen3-235B-A22B",
|
| 31 |
-
token=HF_API_KEY
|
| 32 |
-
)
|
| 33 |
|
| 34 |
# Create final answer instance
|
| 35 |
# final_answer = FinalAnswerTool(model)
|
|
@@ -74,10 +75,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 74 |
|
| 75 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 76 |
try:
|
| 77 |
-
agent =
|
| 78 |
-
tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
|
| 79 |
-
max_steps=20,
|
| 80 |
-
verbosity_level=2)
|
| 81 |
except Exception as e:
|
| 82 |
print(f"Error instantiating agent: {e}")
|
| 83 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
import yaml
|
| 7 |
+
from agent import Agent
|
| 8 |
|
| 9 |
# os.system('pip install "smolagents[transformers]"')
|
| 10 |
# os.system('pip install duckduckgo-search')
|
|
|
|
| 12 |
# os.system('pip install openai')
|
| 13 |
|
| 14 |
# Import modules and classes from openai and smolagents
|
| 15 |
+
# from smolagents import CodeAgent, HfApiModel, DuckDuckGoSearchTool, VisitWebpageTool
|
| 16 |
# from tools import FinalAnswerTool
|
| 17 |
# from huggingface_hub import login
|
| 18 |
|
| 19 |
# Log in to Hugging Face with API_KEY
|
| 20 |
+
# HF_API_KEY = os.getenv("HF_API_KEY")
|
| 21 |
# login(HF_API_KEY)
|
| 22 |
|
| 23 |
# Set API key for OPENAI
|
|
|
|
| 27 |
# model = OpenAIServerModel(model_id="gpt-4o")
|
| 28 |
# model = HfApiModel()
|
| 29 |
|
| 30 |
+
# model = HfApiModel(
|
| 31 |
+
# model_id="Qwen/Qwen3-235B-A22B",
|
| 32 |
+
# token=HF_API_KEY
|
| 33 |
+
# )
|
| 34 |
|
| 35 |
# Create final answer instance
|
| 36 |
# final_answer = FinalAnswerTool(model)
|
|
|
|
| 75 |
|
| 76 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 77 |
try:
|
| 78 |
+
agent = agent = Agent()
|
|
|
|
|
|
|
|
|
|
| 79 |
except Exception as e:
|
| 80 |
print(f"Error instantiating agent: {e}")
|
| 81 |
return f"Error initializing agent: {e}", None
|