Spaces:
Build error
Build error
Commit
·
d489fca
1
Parent(s):
240d240
app.py
Browse files
app.py
CHANGED
@@ -112,7 +112,8 @@ def image_search(search_text, search_image, option):
|
|
112 |
#matched_images = find_matches(text_features, photo_features, photo_ids, 4)
|
113 |
#similarity = util.cos_sim(image_emb, img_emb)
|
114 |
#matched_results = util.semantic_search(image_emb, img_emb, 4)[0]
|
115 |
-
|
|
|
116 |
similarity = util.cos_sim(img_emb, image_emb)
|
117 |
return display_matches(similarity)
|
118 |
|
|
|
112 |
#matched_images = find_matches(text_features, photo_features, photo_ids, 4)
|
113 |
#similarity = util.cos_sim(image_emb, img_emb)
|
114 |
#matched_results = util.semantic_search(image_emb, img_emb, 4)[0]
|
115 |
+
PILIMAGE.fromarray(image.astype('uint8'), 'RGB')
|
116 |
+
image_emb = model.encode([Image.fromarray(search_image.astype('uint8'), 'RGB')], convert_to_tensor=True)
|
117 |
similarity = util.cos_sim(img_emb, image_emb)
|
118 |
return display_matches(similarity)
|
119 |
|