RobotJelly commited on
Commit
940dcd8
1 Parent(s): 0f017d1
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -87,7 +87,7 @@ def image_search(search_text, search_image, option):
87
  #text_features = encode_search_query(search_text, model, device)
88
  text_emb = model.encode([search_text], convert_to_tensor=True)
89
  similarity = util.cos_sim(img_emb, text_emb)
90
- return [Image.open(img_folder / img_names[top_k_best_image]) for top_k_best_image in torch.topk(similarity, 2, 0).indices]
91
  # Find the matched Images
92
  #matched_images = find_matches(text_features, photo_features, photo_ids, 4)
93
  #matched_results = util.semantic_search(text_emb, img_emb, top_k=4)[0]
 
87
  #text_features = encode_search_query(search_text, model, device)
88
  text_emb = model.encode([search_text], convert_to_tensor=True)
89
  similarity = util.cos_sim(img_emb, text_emb)
90
+ return [Image.open(IMAGES_DIR / img_names[top_k_best_image]) for top_k_best_image in torch.topk(similarity, 2, 0).indices]
91
  # Find the matched Images
92
  #matched_images = find_matches(text_features, photo_features, photo_ids, 4)
93
  #matched_results = util.semantic_search(text_emb, img_emb, top_k=4)[0]