tweak m2m model code
Browse files
app.py
CHANGED
@@ -180,7 +180,10 @@ def m2m_trans(article, target_language):
|
|
180 |
result_lang = detect_lang(article)
|
181 |
|
182 |
if result_lang != target_language:
|
183 |
-
|
|
|
|
|
|
|
184 |
else:
|
185 |
return "Error: You chose the same language as the article detected language. Please reselect language and try again."
|
186 |
|
|
|
180 |
result_lang = detect_lang(article)
|
181 |
|
182 |
if result_lang != target_language:
|
183 |
+
if target_language == "English":
|
184 |
+
return m2m_model.translate(article, target_lang="en")
|
185 |
+
elif target_language == "Chinese":
|
186 |
+
return m2m_model.translate(article, target_lang="zh")
|
187 |
else:
|
188 |
return "Error: You chose the same language as the article detected language. Please reselect language and try again."
|
189 |
|