Spaces:
Sleeping
Sleeping
wrong old streamlit api
Browse files
app.py
CHANGED
@@ -13,11 +13,11 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
13 |
from transformers import MarianMTModel, MarianTokenizer
|
14 |
model_name = 'Helsinki-NLP/opus-mt-ROMANCE-en'
|
15 |
|
16 |
-
@st.
|
17 |
def get_tokenizer(model_name):
|
18 |
return MarianTokenizer.from_pretrained(model_name)
|
19 |
|
20 |
-
@st.
|
21 |
def get_model(model_name):
|
22 |
return MarianMTModel.from_pretrained(model_name).to(device)
|
23 |
|
|
|
13 |
from transformers import MarianMTModel, MarianTokenizer
|
14 |
model_name = 'Helsinki-NLP/opus-mt-ROMANCE-en'
|
15 |
|
16 |
+
@st.experimental_singleton
|
17 |
def get_tokenizer(model_name):
|
18 |
return MarianTokenizer.from_pretrained(model_name)
|
19 |
|
20 |
+
@st.experimental_singleton
|
21 |
def get_model(model_name):
|
22 |
return MarianMTModel.from_pretrained(model_name).to(device)
|
23 |
|