Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,9 @@ MODELS = {'benro': 'BlackKakapo/opus-mt-en-ro',
|
|
| 12 |
'broen': 'BlackKakapo/opus-mt-ro-en',
|
| 13 |
'mttcbig': 'Helsinki-NLP/opus-mt-tc-big-en-ro',
|
| 14 |
'gemma': 'Gargaz/gemma-2b-romanian-better',
|
|
|
|
|
|
|
|
|
|
| 15 |
'paraphrase': 'tuner007/pegasus_paraphrase'}
|
| 16 |
EMBEDDING_MODELS = {"all-MiniLM-L6-v2":384,
|
| 17 |
"sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2":384,
|
|
@@ -67,6 +70,11 @@ def translate(input_text: str, model_name: str = MODELS['mttcbig'], sl: str = 'e
|
|
| 67 |
translation, model_name = src.Translate.paraphraseTranslateMethod(input_text, model_name)
|
| 68 |
elif 'Helsinki-NLP' in model_name:
|
| 69 |
translation, message = src.Translate.Translators(model_name, sl, tl, input_text).HelsinkiNLP_mulroa()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
else:
|
| 71 |
translation: str = src.Translate.gemma_direct(input_text, model_name)
|
| 72 |
return {"input_text": input_text, "translation": translation, "model_name": model_name, "message": message}
|
|
|
|
| 12 |
'broen': 'BlackKakapo/opus-mt-ro-en',
|
| 13 |
'mttcbig': 'Helsinki-NLP/opus-mt-tc-big-en-ro',
|
| 14 |
'gemma': 'Gargaz/gemma-2b-romanian-better',
|
| 15 |
+
'mbartenro': 'ancebuc/mbart-translation-en-ro',
|
| 16 |
+
't5enro': "ancebuc/t5-translation-en-ro"),
|
| 17 |
+
'pegasusenro': "ancebuc/ancebuc/pegasus-translation-en-ro"),
|
| 18 |
'paraphrase': 'tuner007/pegasus_paraphrase'}
|
| 19 |
EMBEDDING_MODELS = {"all-MiniLM-L6-v2":384,
|
| 20 |
"sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2":384,
|
|
|
|
| 70 |
translation, model_name = src.Translate.paraphraseTranslateMethod(input_text, model_name)
|
| 71 |
elif 'Helsinki-NLP' in model_name:
|
| 72 |
translation, message = src.Translate.Translators(model_name, sl, tl, input_text).HelsinkiNLP_mulroa()
|
| 73 |
+
# text2textgenerationpipe, translationpipe
|
| 74 |
+
elif model_name == MODELS['mbartenro']:
|
| 75 |
+
translation, message = src.Translate.Translators(model_name, sl, tl, input_text).text2textgenerationpipe()
|
| 76 |
+
elif model_name == MODELS['pegasusenro'] or model_name == MODELS['t5enro']:
|
| 77 |
+
translation, message = src.Translate.Translators(model_name, sl, tl, input_text).text2textgenerationpipe()
|
| 78 |
else:
|
| 79 |
translation: str = src.Translate.gemma_direct(input_text, model_name)
|
| 80 |
return {"input_text": input_text, "translation": translation, "model_name": model_name, "message": message}
|