Spaces:
Sleeping
Sleeping
Move import & adjust advice
Browse filesfrom googletrans import Translator
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
|
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
@@ -20,7 +21,7 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
20 |
|
21 |
@tool
|
22 |
def suissknife_advisor_tool()->str:
|
23 |
-
"""A tool that returns an indication of what to do at the next step - it is useful in cases where there is no other suitable tool at the user's disposal and the user does not know what he wants
|
24 |
May be used prior final answer to remember about additional steps
|
25 |
Args: (no args)
|
26 |
"""
|
@@ -123,7 +124,6 @@ def native_language_translator(text: str, target_lang: str) -> str:
|
|
123 |
target_lang: Target language code (e.g., 'be', 'es', 'fr', 'zh')
|
124 |
"""
|
125 |
try:
|
126 |
-
from googletrans import Translator
|
127 |
translator = Translator()
|
128 |
translation = translator.translate(text, dest=target_lang)
|
129 |
return f"Translated to {target_lang}: {translation.text}"
|
|
|
1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
2 |
+
from googletrans import Translator
|
3 |
import datetime
|
4 |
import requests
|
5 |
import pytz
|
|
|
21 |
|
22 |
@tool
|
23 |
def suissknife_advisor_tool()->str:
|
24 |
+
"""A tool that returns an indication of what to do at the next step - it is useful as first step, before final answer, or in the cases where there is no other suitable tool at the user's disposal and the user does not know what he wants
|
25 |
May be used prior final answer to remember about additional steps
|
26 |
Args: (no args)
|
27 |
"""
|
|
|
124 |
target_lang: Target language code (e.g., 'be', 'es', 'fr', 'zh')
|
125 |
"""
|
126 |
try:
|
|
|
127 |
translator = Translator()
|
128 |
translation = translator.translate(text, dest=target_lang)
|
129 |
return f"Translated to {target_lang}: {translation.text}"
|