feat: TranslationTool
Browse files
app.py
CHANGED
@@ -12,6 +12,7 @@ import pytz
|
|
12 |
import yaml
|
13 |
from tools.final_answer import FinalAnswerTool
|
14 |
from tools.visit_webpage import VisitWebpageTool
|
|
|
15 |
|
16 |
from Gradio_UI import GradioUI
|
17 |
|
@@ -56,6 +57,7 @@ def conversational_utterance(user_content:str)-> str:
|
|
56 |
final_answer = FinalAnswerTool()
|
57 |
web_search = GoogleSearchTool() # DuckDuckGoSearchTool()
|
58 |
visit_webpage = VisitWebpageTool()
|
|
|
59 |
|
60 |
# 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:
|
61 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
@@ -67,19 +69,9 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may
|
|
67 |
custom_role_conversions=None,
|
68 |
)
|
69 |
|
70 |
-
|
71 |
# Import tool from Hub
|
72 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True) # https://huggingface.co/spaces/agents-course/text-to-image
|
73 |
|
74 |
-
translation_model_name = "facebook/nllb-200-distilled-600M"
|
75 |
-
translation_tool = load_tool(
|
76 |
-
"smolagents-tools/translation",
|
77 |
-
model_repo_id=translation_model_name,
|
78 |
-
revision="facebook/nllb-200-distilled-600M/pytorch_model.bin",
|
79 |
-
default_checkpoint="pytorch_model.bin",
|
80 |
-
trust_remote_code=True
|
81 |
-
)
|
82 |
-
|
83 |
with open("prompts.yaml", 'r') as stream:
|
84 |
prompt_templates = yaml.safe_load(stream)
|
85 |
|
@@ -92,7 +84,7 @@ agent = CodeAgent(
|
|
92 |
get_current_time_in_timezone,
|
93 |
conversational_utterance,
|
94 |
image_generation_tool,
|
95 |
-
|
96 |
],
|
97 |
max_steps=6,
|
98 |
verbosity_level=1,
|
|
|
12 |
import yaml
|
13 |
from tools.final_answer import FinalAnswerTool
|
14 |
from tools.visit_webpage import VisitWebpageTool
|
15 |
+
from tools.translation import TranslationTool
|
16 |
|
17 |
from Gradio_UI import GradioUI
|
18 |
|
|
|
57 |
final_answer = FinalAnswerTool()
|
58 |
web_search = GoogleSearchTool() # DuckDuckGoSearchTool()
|
59 |
visit_webpage = VisitWebpageTool()
|
60 |
+
translation_tool = TranslationTool()
|
61 |
|
62 |
# 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:
|
63 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
|
|
69 |
custom_role_conversions=None,
|
70 |
)
|
71 |
|
|
|
72 |
# Import tool from Hub
|
73 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True) # https://huggingface.co/spaces/agents-course/text-to-image
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
with open("prompts.yaml", 'r') as stream:
|
76 |
prompt_templates = yaml.safe_load(stream)
|
77 |
|
|
|
84 |
get_current_time_in_timezone,
|
85 |
conversational_utterance,
|
86 |
image_generation_tool,
|
87 |
+
translation_tool
|
88 |
],
|
89 |
max_steps=6,
|
90 |
verbosity_level=1,
|