Spaces:
Build error
Build error
Commit ·
9073f03
1
Parent(s): b4c60c9
app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,7 @@ def image_search(Option, topk, search_text, search_image):
|
|
| 43 |
similarity = util.cos_sim(img_emb, text_emb)
|
| 44 |
|
| 45 |
#using the computed similarities, find the topk best matches
|
| 46 |
-
return display_matches(similarity, topk)
|
| 47 |
elif Option == "Image-To-Image":
|
| 48 |
# Encode the given Input Image for Search & take it in tensor form
|
| 49 |
image_emb = model.encode([Image.fromarray(search_image)], convert_to_tensor=True)
|
|
@@ -51,7 +51,7 @@ def image_search(Option, topk, search_text, search_image):
|
|
| 51 |
similarity = util.cos_sim(img_emb, image_emb)
|
| 52 |
|
| 53 |
#using the computed similarities, find the topk best matches
|
| 54 |
-
return display_matches(similarity, topk)
|
| 55 |
|
| 56 |
gr.Interface(fn=image_search, title="Search Image",
|
| 57 |
description="Enter the text or image to search the other most relevant images...",
|
|
|
|
| 43 |
similarity = util.cos_sim(img_emb, text_emb)
|
| 44 |
|
| 45 |
#using the computed similarities, find the topk best matches
|
| 46 |
+
return display_matches(similarity, topk+1)
|
| 47 |
elif Option == "Image-To-Image":
|
| 48 |
# Encode the given Input Image for Search & take it in tensor form
|
| 49 |
image_emb = model.encode([Image.fromarray(search_image)], convert_to_tensor=True)
|
|
|
|
| 51 |
similarity = util.cos_sim(img_emb, image_emb)
|
| 52 |
|
| 53 |
#using the computed similarities, find the topk best matches
|
| 54 |
+
return display_matches(similarity, topk+1)
|
| 55 |
|
| 56 |
gr.Interface(fn=image_search, title="Search Image",
|
| 57 |
description="Enter the text or image to search the other most relevant images...",
|