Spaces:
Build error
Build error
Commit
·
38e30d4
1
Parent(s):
163d9e4
app.py
Browse files
app.py
CHANGED
@@ -75,7 +75,7 @@ with open(emb_filename, 'rb') as fIn:
|
|
75 |
img_names, img_emb = pickle.load(fIn)
|
76 |
|
77 |
def display_matches(indices):
|
78 |
-
best_matched_images = [Image.open(os.path.join(
|
79 |
return best_matched_images
|
80 |
|
81 |
def image_search(search_text, search_image, option):
|
@@ -106,8 +106,8 @@ def image_search(search_text, search_image, option):
|
|
106 |
# Find the matched Images
|
107 |
#matched_images = find_matches(image_feature, photo_ids, 4)
|
108 |
|
109 |
-
image_emb = model.encode(
|
110 |
-
|
111 |
# Find the matched Images
|
112 |
#matched_images = find_matches(text_features, photo_features, photo_ids, 4)
|
113 |
#similarity = util.cos_sim(image_emb, img_emb)
|
|
|
75 |
img_names, img_emb = pickle.load(fIn)
|
76 |
|
77 |
def display_matches(indices):
|
78 |
+
best_matched_images = [Image.open(os.path.join("photos/", img_names[best_img['corpus_id']])) for best_img in indices]
|
79 |
return best_matched_images
|
80 |
|
81 |
def image_search(search_text, search_image, option):
|
|
|
106 |
# Find the matched Images
|
107 |
#matched_images = find_matches(image_feature, photo_ids, 4)
|
108 |
|
109 |
+
#image_emb = model.encode(Image.open(search_image), convert_to_tensor=True)
|
110 |
+
image_emb = model.encode(Image.open(search_image))
|
111 |
# Find the matched Images
|
112 |
#matched_images = find_matches(text_features, photo_features, photo_ids, 4)
|
113 |
#similarity = util.cos_sim(image_emb, img_emb)
|