Spaces:
Sleeping
Sleeping
HaggiVaggi
commited on
Commit
·
afdd144
1
Parent(s):
a11e339
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ def embedding_and_index():
|
|
21 |
|
22 |
embeddings_array, index = embedding_and_index()
|
23 |
|
24 |
-
@st.
|
25 |
def load_tokenizer_and_model():
|
26 |
tokenizer = AutoTokenizer.from_pretrained("DeepPavlov/rubert-base-cased-sentence")
|
27 |
model = AutoModel.from_pretrained("DeepPavlov/rubert-base-cased-sentence")
|
@@ -29,7 +29,7 @@ def load_tokenizer_and_model():
|
|
29 |
|
30 |
tokenizer, model = load_tokenizer_and_model()
|
31 |
|
32 |
-
@st.
|
33 |
def encode_description(description, tokenizer, model):
|
34 |
tokens = tokenizer(description, return_tensors="pt")
|
35 |
with torch.no_grad():
|
|
|
21 |
|
22 |
embeddings_array, index = embedding_and_index()
|
23 |
|
24 |
+
@st.cache_resource
|
25 |
def load_tokenizer_and_model():
|
26 |
tokenizer = AutoTokenizer.from_pretrained("DeepPavlov/rubert-base-cased-sentence")
|
27 |
model = AutoModel.from_pretrained("DeepPavlov/rubert-base-cased-sentence")
|
|
|
29 |
|
30 |
tokenizer, model = load_tokenizer_and_model()
|
31 |
|
32 |
+
@st.cache_resource
|
33 |
def encode_description(description, tokenizer, model):
|
34 |
tokens = tokenizer(description, return_tensors="pt")
|
35 |
with torch.no_grad():
|