Spaces:
Running
Running
Update app.py
Browse filesAdded a tool for visiting webpage, based on the tool class included in the template.
app.py
CHANGED
@@ -147,7 +147,11 @@ def summarize_and_answer_from_web(url: str, question:str) -> str:
|
|
147 |
return summary, answer
|
148 |
#return answer
|
149 |
|
150 |
-
|
|
|
|
|
|
|
|
|
151 |
final_answer = FinalAnswerTool()
|
152 |
|
153 |
# 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:
|
@@ -176,7 +180,7 @@ agent = CodeAgent(
|
|
176 |
model=model,
|
177 |
tools=[final_answer, image_generation_tool,webpage_contents_get,
|
178 |
webpage_header_get, webpage_contents_soup_links, webpage_contents_soup_paragraphs,
|
179 |
-
summarize_and_answer_from_web, webpage_json_get], ## add your tools here (don't remove final answer)
|
180 |
max_steps=6,
|
181 |
verbosity_level=1,
|
182 |
grammar=None,
|
|
|
147 |
return summary, answer
|
148 |
#return answer
|
149 |
|
150 |
+
def tool_visit_webpage(url:str):
|
151 |
+
vst = VisitWebpageTool()
|
152 |
+
ret = vst(url)
|
153 |
+
return ret
|
154 |
+
|
155 |
final_answer = FinalAnswerTool()
|
156 |
|
157 |
# 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:
|
|
|
180 |
model=model,
|
181 |
tools=[final_answer, image_generation_tool,webpage_contents_get,
|
182 |
webpage_header_get, webpage_contents_soup_links, webpage_contents_soup_paragraphs,
|
183 |
+
summarize_and_answer_from_web, webpage_json_get, tool_visit_webpage], ## add your tools here (don't remove final answer)
|
184 |
max_steps=6,
|
185 |
verbosity_level=1,
|
186 |
grammar=None,
|