Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,8 @@ import datetime
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
from PIL import Image
|
| 8 |
from Gradio_UI import GradioUI
|
|
@@ -73,13 +75,14 @@ def convert_currency(amount: float, from_currency: str, to_currency: str) -> flo
|
|
| 73 |
rates = response.json()[from_currency.lower()]
|
| 74 |
converted = amount * rates[to_currency.lower()]
|
| 75 |
|
| 76 |
-
return round(converted,
|
| 77 |
|
| 78 |
|
| 79 |
# Import tool from Hub
|
| 80 |
# image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 81 |
-
# search_tool = DuckDuckGoSearchTool()
|
| 82 |
|
|
|
|
|
|
|
| 83 |
final_answer = FinalAnswerTool()
|
| 84 |
|
| 85 |
# 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:
|
|
@@ -97,7 +100,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 97 |
|
| 98 |
agent = CodeAgent(
|
| 99 |
model=model,
|
| 100 |
-
tools=[
|
| 101 |
add_base_tools=True,
|
| 102 |
max_steps=6,
|
| 103 |
verbosity_level=1,
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
+
from tools.web_search import DuckDuckGoSearchTool as WebSearch
|
| 7 |
+
from tools.visit_webpage import VisitWebpageTool as VisitWebpage
|
| 8 |
from tools.final_answer import FinalAnswerTool
|
| 9 |
from PIL import Image
|
| 10 |
from Gradio_UI import GradioUI
|
|
|
|
| 75 |
rates = response.json()[from_currency.lower()]
|
| 76 |
converted = amount * rates[to_currency.lower()]
|
| 77 |
|
| 78 |
+
return round(converted, 3)
|
| 79 |
|
| 80 |
|
| 81 |
# Import tool from Hub
|
| 82 |
# image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
|
|
|
| 83 |
|
| 84 |
+
web_search = WebSearch()
|
| 85 |
+
visit_webpage = VisitWebpage()
|
| 86 |
final_answer = FinalAnswerTool()
|
| 87 |
|
| 88 |
# 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:
|
|
|
|
| 100 |
|
| 101 |
agent = CodeAgent(
|
| 102 |
model=model,
|
| 103 |
+
tools=[get_current_time_in_timezone, convert_currency, wiki_of_person, web_search, visit_webpage, final_answer], ## add your tools here (don't remove final answer)
|
| 104 |
add_base_tools=True,
|
| 105 |
max_steps=6,
|
| 106 |
verbosity_level=1,
|