Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ translation_model = M2M100ForConditionalGeneration.from_pretrained(model_name)
|
|
20 |
@tool
|
21 |
def agent_translate(text: str, detected_lang: str) -> str:
|
22 |
"""A tool that translate text with next logic:
|
23 |
-
1) If text starts with '
|
24 |
2) If detected language == 'ru', translate to English.
|
25 |
3) Else translate to Russian.
|
26 |
and return translated text
|
@@ -28,7 +28,7 @@ def agent_translate(text: str, detected_lang: str) -> str:
|
|
28 |
text: text in russian/english or polish languages.
|
29 |
detected_lang: detected language of the text
|
30 |
"""
|
31 |
-
if text.startswith("
|
32 |
original = text[3:].strip()
|
33 |
target_lang = "PL"
|
34 |
else:
|
|
|
20 |
@tool
|
21 |
def agent_translate(text: str, detected_lang: str) -> str:
|
22 |
"""A tool that translate text with next logic:
|
23 |
+
1) If text starts with 'pl:', translate the rest to Polish.
|
24 |
2) If detected language == 'ru', translate to English.
|
25 |
3) Else translate to Russian.
|
26 |
and return translated text
|
|
|
28 |
text: text in russian/english or polish languages.
|
29 |
detected_lang: detected language of the text
|
30 |
"""
|
31 |
+
if text.startswith("pl:"):
|
32 |
original = text[3:].strip()
|
33 |
target_lang = "PL"
|
34 |
else:
|