Update app.py
Browse files
app.py
CHANGED
@@ -38,22 +38,24 @@ def iwwersetz(source_text, model, direc):
|
|
38 |
if model == "NLLB":
|
39 |
translator = pipeline("translation", model=model_checkpoint_nllb)
|
40 |
if direc == "en -> lb":
|
41 |
-
|
42 |
-
translation = source_text
|
43 |
else:
|
44 |
-
|
45 |
-
translation = source_text
|
46 |
elif model == "MarianNMT":
|
47 |
if direc == "en -> lb":
|
48 |
translator = pipeline("translation", model=model_checkpoint_marian_en)
|
49 |
-
translation = source_text
|
|
|
50 |
else:
|
51 |
translator = pipeline("translation", model=model_checkpoint_marian_lb)
|
52 |
-
translation = source_text
|
|
|
53 |
elif model == "T5-mt5":
|
54 |
translator = pipeline("translation", model=model_checkpoint_t5-mt5)
|
55 |
-
translation = source_text
|
56 |
-
|
57 |
else:
|
58 |
translation = "Please select a Translation Model !"
|
59 |
return translation
|
|
|
38 |
if model == "NLLB":
|
39 |
translator = pipeline("translation", model=model_checkpoint_nllb)
|
40 |
if direc == "en -> lb":
|
41 |
+
translation = translator("en", "lb", source_text)
|
42 |
+
# translation = source_text
|
43 |
else:
|
44 |
+
translation = translator("lb", "en", source_text)
|
45 |
+
# translation = source_text
|
46 |
elif model == "MarianNMT":
|
47 |
if direc == "en -> lb":
|
48 |
translator = pipeline("translation", model=model_checkpoint_marian_en)
|
49 |
+
# translation = source_text
|
50 |
+
translation = translator(source_text)
|
51 |
else:
|
52 |
translator = pipeline("translation", model=model_checkpoint_marian_lb)
|
53 |
+
# translation = source_text
|
54 |
+
translation = translator(source_text)
|
55 |
elif model == "T5-mt5":
|
56 |
translator = pipeline("translation", model=model_checkpoint_t5-mt5)
|
57 |
+
# translation = source_text
|
58 |
+
translation = translator(source_text)
|
59 |
else:
|
60 |
translation = "Please select a Translation Model !"
|
61 |
return translation
|