richylyq commited on
Commit
ea13813
1 Parent(s): b0ae3fd

tweak m2m model code

Browse files
Files changed (1) hide show
  1. app.py +4 -1
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
- return m2m_model.translate(article)
 
 
 
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