Spaces:
Build error
Build error
Commit
·
37a1406
1
Parent(s):
de0179f
app.py
Browse files
app.py
CHANGED
@@ -27,14 +27,18 @@ photos = pd.read_csv("./photos.tsv000", sep="\t", header=0)
|
|
27 |
# taking features vectors
|
28 |
photo_features = np.load("./features.npy")
|
29 |
|
|
|
|
|
30 |
def show_output_image(matched_images) :
|
31 |
image=[]
|
32 |
for photo_id in matched_images:
|
33 |
photo_image_url = f"https://unsplash.com/photos/{photo_id}/download?w=280"
|
34 |
#response = requests.get(photo_image_url, stream=True)
|
35 |
#img = Image.open(BytesIO(response.content))
|
36 |
-
response = requests.get(photo_image_url, stream=True).raw
|
37 |
-
|
|
|
|
|
38 |
image.append(img)
|
39 |
return image
|
40 |
|
|
|
27 |
# taking features vectors
|
28 |
photo_features = np.load("./features.npy")
|
29 |
|
30 |
+
IMAGES_DIR = './photos'
|
31 |
+
|
32 |
def show_output_image(matched_images) :
|
33 |
image=[]
|
34 |
for photo_id in matched_images:
|
35 |
photo_image_url = f"https://unsplash.com/photos/{photo_id}/download?w=280"
|
36 |
#response = requests.get(photo_image_url, stream=True)
|
37 |
#img = Image.open(BytesIO(response.content))
|
38 |
+
#response = requests.get(photo_image_url, stream=True).raw
|
39 |
+
photo = photo_id + '.jpg'
|
40 |
+
#img = Image.open(response).convert("RGB")
|
41 |
+
img = Image.open(os.path.join(IMAGES_DIR, photo))
|
42 |
image.append(img)
|
43 |
return image
|
44 |
|