Spaces:
Sleeping
Sleeping
peterbonnesoeur
commited on
Commit
·
724e453
1
Parent(s):
fae2fcb
Added more docs
Browse files
tool.py
CHANGED
@@ -27,6 +27,17 @@ class TranslateTool(Tool):
|
|
27 |
output_type = "string"
|
28 |
|
29 |
async def translate_text(text: str, src: str, dest: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
from googletrans import Translator
|
31 |
async with Translator() as translator:
|
32 |
res = await translator.translate(text, src, dest)
|
|
|
27 |
output_type = "string"
|
28 |
|
29 |
async def translate_text(text: str, src: str, dest: str):
|
30 |
+
"""
|
31 |
+
Translates text from one language to another using the Google Translate API.
|
32 |
+
|
33 |
+
Args:
|
34 |
+
text (str): The text to translate.
|
35 |
+
src (str): The source language code.
|
36 |
+
dest (str): The target language code.
|
37 |
+
|
38 |
+
Returns:
|
39 |
+
str: The translated text.
|
40 |
+
"""
|
41 |
from googletrans import Translator
|
42 |
async with Translator() as translator:
|
43 |
res = await translator.translate(text, src, dest)
|