SajjadAyoubi commited on
Commit
c2cf659
1 Parent(s): 4f12085

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -36,9 +36,8 @@ def get_html(url_list, height=224):
36
 
37
  st.cache(show_spinner=False)
38
  def image_search(query, top_k=8):
39
- torch.no_grad():
40
- text_embedding = text_encoder(
41
- **tokenizer(query, return_tensors='pt')).pooler_output
42
  values, indices = torch.cosine_similarity(text_embedding, image_embeddings).sort(descending=True)
43
  return [(df.iloc[i]['path'], df.iloc[i]['link']) for i in indices[:top_k]]
44
 
 
36
 
37
  st.cache(show_spinner=False)
38
  def image_search(query, top_k=8):
39
+ with torch.no_grad():
40
+ text_embedding = text_encoder(**tokenizer(query, return_tensors='pt')).pooler_output
 
41
  values, indices = torch.cosine_similarity(text_embedding, image_embeddings).sort(descending=True)
42
  return [(df.iloc[i]['path'], df.iloc[i]['link']) for i in indices[:top_k]]
43