Spaces:
Build error
Build error
Commit ·
74888a6
1
Parent(s): c36f360
app.py
Browse files
app.py
CHANGED
|
@@ -31,17 +31,17 @@ photo_features = np.load("./features.npy")
|
|
| 31 |
def show_output_image(matched_images) :
|
| 32 |
image=[]
|
| 33 |
for photo_id in matched_images:
|
| 34 |
-
|
| 35 |
#photo_image_url = f"https://unsplash.com/photos/{photo_id}?w=640"
|
| 36 |
#photo_image_url = f"https://unsplash.com/photos/{photo_id}?ixid=2yJhcHBfaWQiOjEyMDd9&fm=jpg"
|
| 37 |
#photo_found = photos[photos["photo_id"] == photo_id].iloc[0]
|
| 38 |
#response = requests.get(photo_found["photo_image_url"] + "?w=640")
|
| 39 |
-
|
| 40 |
-
|
| 41 |
#return img
|
| 42 |
-
photo_jpg = photo_id + '.jpg'
|
| 43 |
-
image_path = './photos/'
|
| 44 |
-
img = Image.open('./photos/'+photo_jpg)
|
| 45 |
image.append(img)
|
| 46 |
return image
|
| 47 |
# Encode and normalize the search query using CLIP
|
|
|
|
| 31 |
def show_output_image(matched_images) :
|
| 32 |
image=[]
|
| 33 |
for photo_id in matched_images:
|
| 34 |
+
photo_image_url = f"https://unsplash.com/photos/{photo_id}/download?w=280"
|
| 35 |
#photo_image_url = f"https://unsplash.com/photos/{photo_id}?w=640"
|
| 36 |
#photo_image_url = f"https://unsplash.com/photos/{photo_id}?ixid=2yJhcHBfaWQiOjEyMDd9&fm=jpg"
|
| 37 |
#photo_found = photos[photos["photo_id"] == photo_id].iloc[0]
|
| 38 |
#response = requests.get(photo_found["photo_image_url"] + "?w=640")
|
| 39 |
+
response = requests.get(photo_image_url)
|
| 40 |
+
img = Image.open(BytesIO(response.content))
|
| 41 |
#return img
|
| 42 |
+
#photo_jpg = photo_id + '.jpg'
|
| 43 |
+
#image_path = './photos/'
|
| 44 |
+
#img = Image.open('./photos/'+photo_jpg)
|
| 45 |
image.append(img)
|
| 46 |
return image
|
| 47 |
# Encode and normalize the search query using CLIP
|