Update app.py
Browse files
app.py
CHANGED
@@ -4,12 +4,12 @@ import docx2txt
|
|
4 |
from transformers import pipeline
|
5 |
import sentencepiece
|
6 |
|
7 |
-
#
|
8 |
def load_translation_models():
|
9 |
-
"""Load translation models
|
10 |
try:
|
11 |
translator_en = pipeline("translation", model="Helsinki-NLP/opus-mt-mul-en", framework="pt")
|
12 |
-
translator_ur = pipeline("translation", model="Helsinki-NLP/opus-mt-
|
13 |
return translator_en, translator_ur
|
14 |
except Exception as e:
|
15 |
st.error(f"Error initializing translation models: {e}")
|
|
|
4 |
from transformers import pipeline
|
5 |
import sentencepiece
|
6 |
|
7 |
+
# Load translation models
|
8 |
def load_translation_models():
|
9 |
+
"""Load translation models for English and Urdu."""
|
10 |
try:
|
11 |
translator_en = pipeline("translation", model="Helsinki-NLP/opus-mt-mul-en", framework="pt")
|
12 |
+
translator_ur = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ur", framework="pt")
|
13 |
return translator_en, translator_ur
|
14 |
except Exception as e:
|
15 |
st.error(f"Error initializing translation models: {e}")
|