n-k-rush commited on
Commit
2da16fa
·
verified ·
1 Parent(s): a6865a9

Fully translate safety warning on hosted demo

Browse files

On the no-GPU Space, show the translated general safety advice for non-English
languages instead of mixing English and the chosen language.

Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -1242,7 +1242,12 @@ def read_label(
1242
  manual_help = hide_manual_label_help()
1243
  manual_label_update = manual_label_optional_placeholder(language)
1244
 
1245
- if medicine_warning:
 
 
 
 
 
1246
  try:
1247
  translated_warning = translate_medicine_warning(medicine_warning, language, use_ai_model, model_url)
1248
  except TinyAyaUnavailableError:
 
1242
  manual_help = hide_manual_label_help()
1243
  manual_label_update = manual_label_optional_placeholder(language)
1244
 
1245
+ if medicine_warning and IS_HOSTED and not use_ai_model and language != "English":
1246
+ # On the no-GPU hosted demo Tiny Aya cannot translate the free-text
1247
+ # medicine-specific warning, so show the fully translated general safety
1248
+ # advice instead of a mixed English/translated box. (Desktop is unaffected.)
1249
+ safety_warning = GENERAL_SAFETY_WARNING[language]
1250
+ elif medicine_warning:
1251
  try:
1252
  translated_warning = translate_medicine_warning(medicine_warning, language, use_ai_model, model_url)
1253
  except TinyAyaUnavailableError: