Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -78,12 +78,13 @@ def translate(input_text, source, target):
|
|
78 |
target = target_lang_dict[target]
|
79 |
|
80 |
try:
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
85 |
except KeyError:
|
86 |
-
|
87 |
|
88 |
with st.container():
|
89 |
st.header("Basque (EU) Euskera Multilingual Translator (Basque as the Starting Point)")
|
|
|
78 |
target = target_lang_dict[target]
|
79 |
|
80 |
try:
|
81 |
+
target = target_lang_dict[target]
|
82 |
+
model = f"Helsinki-NLP/opus-mt-{source}-{target}"
|
83 |
+
pipe = pipeline("translation", model=model)
|
84 |
+
translation = pipe(input_text)
|
85 |
+
return translation[0]['translation_text']
|
86 |
except KeyError:
|
87 |
+
return f"Error: Translation from {source_readable} to {target} is not supported"
|
88 |
|
89 |
with st.container():
|
90 |
st.header("Basque (EU) Euskera Multilingual Translator (Basque as the Starting Point)")
|