Spaces:
Runtime error
Runtime error
Commit
·
16b83cd
1
Parent(s):
f98b9ee
Update app.py
Browse files
app.py
CHANGED
@@ -22,14 +22,15 @@ links = np.load('data.npy', allow_pickle=True)
|
|
22 |
|
23 |
|
24 |
|
25 |
-
def get_html(url_list, height=
|
26 |
html = "<div style='margin-top: 20px; max-width: 1200px; display: flex; flex-wrap: wrap; justify-content: space-evenly'>"
|
27 |
for url in url_list:
|
28 |
html2 = f"<img style='height: {height}px; margin: 5px' src='{escape(url)}'>"
|
29 |
html = html + html2
|
30 |
html += "</div>"
|
31 |
return html
|
32 |
-
|
|
|
33 |
def image_search(query, top_k=8):
|
34 |
with torch.no_grad():
|
35 |
text_embedding = text_encoder(**tokenizer(query, return_tensors='pt')).pooler_output
|
|
|
22 |
|
23 |
|
24 |
|
25 |
+
def get_html(url_list, height=180):
|
26 |
html = "<div style='margin-top: 20px; max-width: 1200px; display: flex; flex-wrap: wrap; justify-content: space-evenly'>"
|
27 |
for url in url_list:
|
28 |
html2 = f"<img style='height: {height}px; margin: 5px' src='{escape(url)}'>"
|
29 |
html = html + html2
|
30 |
html += "</div>"
|
31 |
return html
|
32 |
+
|
33 |
+
@st.cache(show_spinner=False)
|
34 |
def image_search(query, top_k=8):
|
35 |
with torch.no_grad():
|
36 |
text_embedding = text_encoder(**tokenizer(query, return_tensors='pt')).pooler_output
|