SajjadAyoubi commited on
Commit
1710a12
·
1 Parent(s): fd5142b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -22,7 +22,7 @@ links = np.load('data.npy', allow_pickle=True)
22
 
23
 
24
 
25
- def get_html(url_list, height=300):
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)}'>"
@@ -31,7 +31,7 @@ def get_html(url_list, height=300):
31
  return html
32
 
33
 
34
- def image_search(query, top_k=10):
35
  with torch.no_grad():
36
  text_embedding = text_encoder(**tokenizer(query, return_tensors='pt')).pooler_output
37
  values, indices = torch.cosine_similarity(text_embedding, image_embeddings).sort(descending=True)
 
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)}'>"
 
31
  return html
32
 
33
 
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
37
  values, indices = torch.cosine_similarity(text_embedding, image_embeddings).sort(descending=True)