Spaces:
Running
Running
cache tokenizer and specify ITALIAN query string :D
Browse files
app.py
CHANGED
@@ -25,6 +25,11 @@ def get_model():
|
|
25 |
return FlaxHybridCLIP.from_pretrained("clip-italian/clip-italian")
|
26 |
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
@st.cache
|
29 |
def download_images():
|
30 |
# from sentence_transformers import SentenceTransformer, util
|
@@ -58,7 +63,7 @@ def get_image_features():
|
|
58 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
59 |
|
60 |
|
61 |
-
query = st.text_input("Insert
|
62 |
if query:
|
63 |
|
64 |
with st.spinner("Computing in progress..."):
|
@@ -68,9 +73,7 @@ if query:
|
|
68 |
image_features = get_image_features()
|
69 |
|
70 |
model = get_model()
|
71 |
-
tokenizer =
|
72 |
-
"dbmdz/bert-base-italian-xxl-uncased", cache_dir=None, use_fast=True
|
73 |
-
)
|
74 |
|
75 |
image_size = model.config.vision_config.image_size
|
76 |
|
|
|
25 |
return FlaxHybridCLIP.from_pretrained("clip-italian/clip-italian")
|
26 |
|
27 |
|
28 |
+
@st.cache
|
29 |
+
def get_tokenizer():
|
30 |
+
return AutoTokenizer.from_pretrained("dbmdz/bert-base-italian-xxl-uncased", cache_dir=None, use_fast=True)
|
31 |
+
|
32 |
+
|
33 |
@st.cache
|
34 |
def download_images():
|
35 |
# from sentence_transformers import SentenceTransformer, util
|
|
|
63 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
64 |
|
65 |
|
66 |
+
query = st.text_input("Insert an italian query text here...")
|
67 |
if query:
|
68 |
|
69 |
with st.spinner("Computing in progress..."):
|
|
|
73 |
image_features = get_image_features()
|
74 |
|
75 |
model = get_model()
|
76 |
+
tokenizer = get_tokenizer()
|
|
|
|
|
77 |
|
78 |
image_size = model.config.vision_config.image_size
|
79 |
|