Update app.py
Browse files
app.py
CHANGED
@@ -3,10 +3,10 @@ import torch
|
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
|
11 |
my_title = "🇬🇧 Mir iwwersetzen vun an op Lëtzebuergesch ! 🇫🇷"
|
12 |
my_description = "English-Luxembourgish machine translation (MT) demo based on 3 open-source transformer models: Facebook-NLLB, Microsoft-MarianNMT & Google-T5/mt5."
|
@@ -36,7 +36,8 @@ my_output = gr.Textbox(lines=5, label="Translation")
|
|
36 |
|
37 |
def iwwersetz(source_text, model, direc):
|
38 |
if model == "NLLB":
|
39 |
-
|
|
|
40 |
# translation = translator("en", "lb", source_text)
|
41 |
translation = source_text
|
42 |
else:
|
|
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
5 |
|
6 |
+
model_checkpoint_nllb = "facebook/nllb-200-distilled-600M"
|
7 |
+
model_checkpoint_marion_en = "mbarnig/MarianNMT-tatoeba-en-lb"
|
8 |
+
model_checkpoint_marion_lb = "mbarnig/MarianNMT-tatoeba-lb-en"
|
9 |
+
model_checkpoint_t5_mt5 = "mbarnig/T5-mt5-tatoeba-en-lb"
|
10 |
|
11 |
my_title = "🇬🇧 Mir iwwersetzen vun an op Lëtzebuergesch ! 🇫🇷"
|
12 |
my_description = "English-Luxembourgish machine translation (MT) demo based on 3 open-source transformer models: Facebook-NLLB, Microsoft-MarianNMT & Google-T5/mt5."
|
|
|
36 |
|
37 |
def iwwersetz(source_text, model, direc):
|
38 |
if model == "NLLB":
|
39 |
+
translator = pipeline("translation", model=model_checkpoint)
|
40 |
+
if direc == "en -> lb":
|
41 |
# translation = translator("en", "lb", source_text)
|
42 |
translation = source_text
|
43 |
else:
|