change name for article text box
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ def detect_lang(article, target_lang):
|
|
41 |
return result_lang[0]
|
42 |
|
43 |
|
44 |
-
def opus_trans(
|
45 |
"""
|
46 |
Translation by Helsinki-NLP model
|
47 |
|
@@ -62,7 +62,7 @@ def opus_trans(message, target_lang):
|
|
62 |
task_name = f"translation_{result_lang}_to_{target_lang}"
|
63 |
model_name = f"Helsinki-NLP/opus-mt-{result_lang}-{target_lang}"
|
64 |
translator = pipeline(task_name, model=model_name, tokenizer=model_name)
|
65 |
-
translated = translator(
|
66 |
print(translated)
|
67 |
return translated
|
68 |
|
|
|
41 |
return result_lang[0]
|
42 |
|
43 |
|
44 |
+
def opus_trans(article, target_lang):
|
45 |
"""
|
46 |
Translation by Helsinki-NLP model
|
47 |
|
|
|
62 |
task_name = f"translation_{result_lang}_to_{target_lang}"
|
63 |
model_name = f"Helsinki-NLP/opus-mt-{result_lang}-{target_lang}"
|
64 |
translator = pipeline(task_name, model=model_name, tokenizer=model_name)
|
65 |
+
translated = translator(article)[0]["translation_text"]
|
66 |
print(translated)
|
67 |
return translated
|
68 |
|