Spaces:
Running
Running
Commit ·
d727f08
1
Parent(s): 415d5ea
selection
Browse files
app.py
CHANGED
|
@@ -229,9 +229,10 @@ def save_embedding(folder=FOLDER):
|
|
| 229 |
|
| 230 |
def display_image(idx, dist):
|
| 231 |
file_paths = get_all_file_paths(folder_path=FOLDER)
|
|
|
|
| 232 |
image = Image.open(file_paths[idx])
|
| 233 |
st.image(image.resize([256, 256]))
|
| 234 |
-
st.markdown("SimScore: -" + str(round(dist, 2)))
|
| 235 |
# st.markdown(file_paths[idx])
|
| 236 |
|
| 237 |
|
|
@@ -260,10 +261,10 @@ if __name__ == "__main__":
|
|
| 260 |
)
|
| 261 |
|
| 262 |
if uploaded_file is not None:
|
| 263 |
-
query_image = Image.open(uploaded_file)
|
| 264 |
-
cropped = st_cropper(query_image)
|
| 265 |
query_image, nearest_neighbors, distances = search_similar_images(
|
| 266 |
-
cropped.resize([
|
| 267 |
)
|
| 268 |
|
| 269 |
st.subheader("Similar Images:")
|
|
|
|
| 229 |
|
| 230 |
def display_image(idx, dist):
|
| 231 |
file_paths = get_all_file_paths(folder_path=FOLDER)
|
| 232 |
+
# print(file_paths[idx])
|
| 233 |
image = Image.open(file_paths[idx])
|
| 234 |
st.image(image.resize([256, 256]))
|
| 235 |
+
st.markdown("SimScore: -" + str(round(-dist, 2)))
|
| 236 |
# st.markdown(file_paths[idx])
|
| 237 |
|
| 238 |
|
|
|
|
| 261 |
)
|
| 262 |
|
| 263 |
if uploaded_file is not None:
|
| 264 |
+
query_image = Image.open(uploaded_file).resize([224, 224])
|
| 265 |
+
cropped = st_cropper(query_image, default_coords=[10, 240, 10, 240])
|
| 266 |
query_image, nearest_neighbors, distances = search_similar_images(
|
| 267 |
+
cropped.resize([224, 224]), n_matches
|
| 268 |
)
|
| 269 |
|
| 270 |
st.subheader("Similar Images:")
|