Spaces:
Sleeping
Sleeping
visit web bage
Browse files- app.py +4 -6
- tools/visit_webpage.py +1 -0
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
5 |
import yaml
|
6 |
-
from tools.final_answer import FinalAnswerTool
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
@@ -35,9 +35,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
35 |
|
36 |
|
37 |
final_answer = FinalAnswerTool()
|
38 |
-
|
39 |
-
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
40 |
-
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
41 |
|
42 |
model = HfApiModel(
|
43 |
max_tokens=2096,
|
@@ -55,7 +53,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
55 |
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
-
tools=[final_answer, image_generation_tool], ## add your tools here (don't remove final answer)
|
59 |
max_steps=6,
|
60 |
verbosity_level=1,
|
61 |
grammar=None,
|
|
|
1 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
5 |
import yaml
|
6 |
+
from tools.final_answer import FinalAnswerTool, VisitWebpageTool
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
|
|
35 |
|
36 |
|
37 |
final_answer = FinalAnswerTool()
|
38 |
+
visit_page = VisitWebpageTool()
|
|
|
|
|
39 |
|
40 |
model = HfApiModel(
|
41 |
max_tokens=2096,
|
|
|
53 |
|
54 |
agent = CodeAgent(
|
55 |
model=model,
|
56 |
+
tools=[final_answer, image_generation_tool, visit_page], ## add your tools here (don't remove final answer)
|
57 |
max_steps=6,
|
58 |
verbosity_level=1,
|
59 |
grammar=None,
|
tools/visit_webpage.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
import requests
|
|
|
1 |
+
import re
|
2 |
from typing import Any, Optional
|
3 |
from smolagents.tools import Tool
|
4 |
import requests
|