Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,12 +100,12 @@ class Translators:
|
|
| 100 |
def HelsinkiNLP_mulmul(self):
|
| 101 |
try:
|
| 102 |
pipe = pipeline("translation", model=self.model_name, device=self.device)
|
| 103 |
-
|
| 104 |
-
iso3tl =
|
| 105 |
translation = pipe(f'>>{iso3tl}<< {self.input_text}')
|
| 106 |
-
return translation[0]['translation_text'], f'Translated from {self.sl} to {self.tl} with {model_name}.'
|
| 107 |
except Exception as error:
|
| 108 |
-
return f"Error translating with model: {model_name}! Try other available language combination.", error
|
| 109 |
|
| 110 |
def HelsinkiNLP(self):
|
| 111 |
try: # Standard bilingual model
|
|
|
|
| 100 |
def HelsinkiNLP_mulmul(self):
|
| 101 |
try:
|
| 102 |
pipe = pipeline("translation", model=self.model_name, device=self.device)
|
| 103 |
+
iso_dict = {iso[1]: iso[3]) for iso in non_empty_isos}
|
| 104 |
+
iso3tl = iso_dict.get(self.tl) # 'deu', 'ron', 'eng', 'fra'
|
| 105 |
translation = pipe(f'>>{iso3tl}<< {self.input_text}')
|
| 106 |
+
return translation[0]['translation_text'], f'Translated from {self.sl} to {self.tl} with {self.model_name}.'
|
| 107 |
except Exception as error:
|
| 108 |
+
return f"Error translating with model: {self.model_name}! Try other available language combination.", error
|
| 109 |
|
| 110 |
def HelsinkiNLP(self):
|
| 111 |
try: # Standard bilingual model
|