TANVEERMAKHDOOM
commited on
Commit
•
68021a2
1
Parent(s):
de0847d
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Initialize the model and tokenizer
|
5 |
def load_model_and_tokenizer(target_lang):
|
|
|
1 |
+
pip uninstall transformers torch streamlit
|
2 |
+
pip install transformers torch streamlit
|
3 |
+
try:
|
4 |
+
from transformers import MarianMTModel, MarianTokenizer
|
5 |
+
print("Transformers imported successfully")
|
6 |
+
except ImportError as e:
|
7 |
+
print(f"ImportError: {e}")
|
8 |
+
|
9 |
import streamlit as st
|
10 |
+
|
11 |
+
# Attempt to import the transformers package
|
12 |
+
try:
|
13 |
+
from transformers import MarianMTModel, MarianTokenizer
|
14 |
+
except ImportError as e:
|
15 |
+
st.error("Failed to import transformers. Please make sure it is installed.")
|
16 |
+
st.stop()
|
17 |
|
18 |
# Initialize the model and tokenizer
|
19 |
def load_model_and_tokenizer(target_lang):
|