Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ options.extend(list(all_langs.keys()))
|
|
| 15 |
models = ["Helsinki-NLP",
|
| 16 |
"t5-small", "t5-base", "t5-large",
|
| 17 |
"google/flan-t5-small", "google/flan-t5-base", "google/flan-t5-large", "google/flan-t5-xl",
|
| 18 |
-
"facebook/nllb-200-distilled-600M", "facebook/nllb-200-distilled-1.3B", "facebook/nllb-200-1.3B",
|
| 19 |
"facebook/mbart-large-50-many-to-many-mmt", "facebook/mbart-large-50-one-to-many-mmt", "facebook/mbart-large-50-many-to-one-mmt",
|
| 20 |
"facebook/m2m100_418M", "facebook/m2m100_1.2B",
|
| 21 |
"bigscience/mt0-small", "bigscience/mt0-base", "bigscience/mt0-large", "bigscience/mt0-xl",
|
|
@@ -55,7 +55,8 @@ def argos(sl, tl, input_text):
|
|
| 55 |
download_argos_model(sl, tl)
|
| 56 |
translated_text = argostranslate.translate.translate(input_text, sl, tl)
|
| 57 |
except StopIteration:
|
| 58 |
-
|
|
|
|
| 59 |
except Exception as error:
|
| 60 |
translated_text = error
|
| 61 |
return translated_text
|
|
@@ -328,7 +329,8 @@ def translate_text(input_text: str, sselected_language: str, tselected_language:
|
|
| 328 |
|
| 329 |
except Exception as error:
|
| 330 |
translated_text = error
|
| 331 |
-
|
|
|
|
| 332 |
|
| 333 |
# Function to swap dropdown values
|
| 334 |
def swap_languages(src_lang, tgt_lang):
|
|
|
|
| 15 |
models = ["Helsinki-NLP",
|
| 16 |
"t5-small", "t5-base", "t5-large",
|
| 17 |
"google/flan-t5-small", "google/flan-t5-base", "google/flan-t5-large", "google/flan-t5-xl",
|
| 18 |
+
"facebook/nllb-200-distilled-600M", "facebook/nllb-200-distilled-1.3B", "facebook/nllb-200-1.3B", "facebook/nllb-200-3.3B",
|
| 19 |
"facebook/mbart-large-50-many-to-many-mmt", "facebook/mbart-large-50-one-to-many-mmt", "facebook/mbart-large-50-many-to-one-mmt",
|
| 20 |
"facebook/m2m100_418M", "facebook/m2m100_1.2B",
|
| 21 |
"bigscience/mt0-small", "bigscience/mt0-base", "bigscience/mt0-large", "bigscience/mt0-xl",
|
|
|
|
| 55 |
download_argos_model(sl, tl)
|
| 56 |
translated_text = argostranslate.translate.translate(input_text, sl, tl)
|
| 57 |
except StopIteration:
|
| 58 |
+
all_argos_combos = ', '.join(argostranslate.package.get_available_packages())
|
| 59 |
+
translated_text = f"No Argos model for {sl} to {tl}. Try other model or languages combination! Available Argos models: {all_argos_combos}."
|
| 60 |
except Exception as error:
|
| 61 |
translated_text = error
|
| 62 |
return translated_text
|
|
|
|
| 329 |
|
| 330 |
except Exception as error:
|
| 331 |
translated_text = error
|
| 332 |
+
finally:
|
| 333 |
+
return translated_text, message_text
|
| 334 |
|
| 335 |
# Function to swap dropdown values
|
| 336 |
def swap_languages(src_lang, tgt_lang):
|