Spaces:
Running
Running
sashavor
commited on
Commit
•
a6e0232
1
Parent(s):
3ae84a3
changing to butterflies
Browse files
0.png
DELETED
Binary file (547 kB)
|
|
1.png
DELETED
Binary file (510 kB)
|
|
2.png
DELETED
Binary file (607 kB)
|
|
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: yellow
|
5 |
colorTo: blue
|
6 |
sdk: gradio
|
|
|
1 |
---
|
2 |
+
title: Find My Butterfly 🦋
|
3 |
+
emoji: 🦋
|
4 |
colorFrom: yellow
|
5 |
colorTo: blue
|
6 |
sdk: gradio
|
app.py
CHANGED
@@ -1,6 +1,3 @@
|
|
1 |
-
"""
|
2 |
-
Thanks to Freddy Boulton (https://github.com/freddyaboulton) for helping with this.
|
3 |
-
"""
|
4 |
|
5 |
|
6 |
import pickle
|
@@ -20,13 +17,13 @@ with open("lsh.pickle", "rb") as handle:
|
|
20 |
loaded_lsh = pickle.load(handle)
|
21 |
|
22 |
# Load model for computing embeddings.
|
23 |
-
model_ckpt = "
|
24 |
model = AutoModel.from_pretrained(model_ckpt)
|
25 |
lsh_builder = BuildLSHTable(model)
|
26 |
lsh_builder.lsh = loaded_lsh
|
27 |
|
28 |
# Candidate images.
|
29 |
-
dataset = load_dataset("
|
30 |
candidate_dataset = dataset["train"].shuffle(seed=seed)
|
31 |
|
32 |
|
@@ -57,7 +54,7 @@ def query(image, top_k):
|
|
57 |
return list(zip(images, labels))
|
58 |
|
59 |
|
60 |
-
title = "
|
61 |
description = "This Space demos an image similarity system. You can refer to [this notebook](TODO) to know the details of the system. You can pick any image from the available samples below. On the right hand side, you'll find the similar images returned by the system. The example images have been named with their corresponding integer class labels for easier identification. The fetched images will also have their integer labels tagged so that you can validate the correctness of the results."
|
62 |
|
63 |
# You can set the type of gr.Image to be PIL, numpy or str (filepath)
|
|
|
|
|
|
|
|
|
1 |
|
2 |
|
3 |
import pickle
|
|
|
17 |
loaded_lsh = pickle.load(handle)
|
18 |
|
19 |
# Load model for computing embeddings.
|
20 |
+
model_ckpt = "abhishek/autotrain-butterflies-new-17716425"
|
21 |
model = AutoModel.from_pretrained(model_ckpt)
|
22 |
lsh_builder = BuildLSHTable(model)
|
23 |
lsh_builder.lsh = loaded_lsh
|
24 |
|
25 |
# Candidate images.
|
26 |
+
dataset = load_dataset("huggan/inat_butterflies_top10k")
|
27 |
candidate_dataset = dataset["train"].shuffle(seed=seed)
|
28 |
|
29 |
|
|
|
54 |
return list(zip(images, labels))
|
55 |
|
56 |
|
57 |
+
title = "Find my Butterfly"
|
58 |
description = "This Space demos an image similarity system. You can refer to [this notebook](TODO) to know the details of the system. You can pick any image from the available samples below. On the right hand side, you'll find the similar images returned by the system. The example images have been named with their corresponding integer class labels for easier identification. The fetched images will also have their integer labels tagged so that you can validate the correctness of the results."
|
59 |
|
60 |
# You can set the type of gr.Image to be PIL, numpy or str (filepath)
|