Spaces:
Runtime error
Runtime error
Commit
·
7b047ff
1
Parent(s):
f5b0740
Update app.py
Browse files
app.py
CHANGED
@@ -21,12 +21,6 @@ model_name = "sentence-transformers/all-distilroberta-v1"
|
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
22 |
model = SentenceTransformer(model_name)
|
23 |
|
24 |
-
# # Load the FAISS index
|
25 |
-
# index_name = 'index.faiss'
|
26 |
-
# index_url = './'
|
27 |
-
# wget.download(index_url, index_name)
|
28 |
-
# index = faiss.read_index(faiss_flickr8k.index)
|
29 |
-
|
30 |
# Define the path to the zip folder containing the images
|
31 |
zip_path = "Images.zip"
|
32 |
|
@@ -63,14 +57,10 @@ def search(query, k=5):
|
|
63 |
for i in I[0]:
|
64 |
text_id = i
|
65 |
image_id = str(image_list[i])
|
66 |
-
image_data = zip_file.read(image_id)
|
67 |
image = Image.open(image_data)
|
68 |
-
# image = Image.open(io.BytesIO(image_data))
|
69 |
st.image(image, caption=image_name, width=200)
|
70 |
-
# image_url = "./Images/" + image_id
|
71 |
-
# image_urls.append(image_url)
|
72 |
|
73 |
-
# return image_urls
|
74 |
|
75 |
st.title("Image Search App")
|
76 |
|
|
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
22 |
model = SentenceTransformer(model_name)
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
# Define the path to the zip folder containing the images
|
25 |
zip_path = "Images.zip"
|
26 |
|
|
|
57 |
for i in I[0]:
|
58 |
text_id = i
|
59 |
image_id = str(image_list[i])
|
60 |
+
image_data = zip_file.read("Images/" +image_id)
|
61 |
image = Image.open(image_data)
|
|
|
62 |
st.image(image, caption=image_name, width=200)
|
|
|
|
|
63 |
|
|
|
64 |
|
65 |
st.title("Image Search App")
|
66 |
|