Spaces:
Runtime error
Runtime error
Commit
·
28dd995
1
Parent(s):
a3280c3
Update app.py
Browse files
app.py
CHANGED
@@ -8,19 +8,16 @@ import transformers
|
|
8 |
from transformers import RobertaModel, AutoTokenizer
|
9 |
|
10 |
#@st.cache(hash_funcs={transformers.models.roberta.tokenization_roberta_fast.RobertaTokenizerFast: hash}, suppress_st_warning=True, allow_output_mutation=True)
|
11 |
-
@st.cache(show_spinner=False
|
12 |
-
hash_funcs={RobertaModel: lambda _: None,
|
13 |
-
AutoTokenizer: lambda _: None,
|
14 |
-
dict: lambda _: None})
|
15 |
def load():
|
16 |
text_encoder = RobertaModel.from_pretrained('SajjadAyoubi/clip-fa-text')
|
17 |
-
tokenizer = AutoTokenizer.from_pretrained('SajjadAyoubi/clip-fa-text')
|
18 |
image_embeddings = torch.load('embedding.pt')
|
19 |
links = np.load('data.npy', allow_pickle=True)
|
20 |
-
return text_encoder,
|
21 |
|
22 |
|
23 |
-
|
|
|
24 |
|
25 |
|
26 |
def get_html(url_list, height=224):
|
|
|
8 |
from transformers import RobertaModel, AutoTokenizer
|
9 |
|
10 |
#@st.cache(hash_funcs={transformers.models.roberta.tokenization_roberta_fast.RobertaTokenizerFast: hash}, suppress_st_warning=True, allow_output_mutation=True)
|
11 |
+
@st.cache(show_spinner=False)
|
|
|
|
|
|
|
12 |
def load():
|
13 |
text_encoder = RobertaModel.from_pretrained('SajjadAyoubi/clip-fa-text')
|
|
|
14 |
image_embeddings = torch.load('embedding.pt')
|
15 |
links = np.load('data.npy', allow_pickle=True)
|
16 |
+
return text_encoder, links, image_embeddings
|
17 |
|
18 |
|
19 |
+
tokenizer = AutoTokenizer.from_pretrained('SajjadAyoubi/clip-fa-text')
|
20 |
+
text_encoder, links, image_embeddings = load()
|
21 |
|
22 |
|
23 |
def get_html(url_list, height=224):
|