Spaces:
Runtime error
Runtime error
sashavor
commited on
Commit
•
f46cf6c
1
Parent(s):
b597545
updating index
Browse files- app.py +4 -4
- slugs_index_1024_cosine.pickle +2 -2
app.py
CHANGED
@@ -9,11 +9,11 @@ with open("slugs_index_1024_cosine.pickle", "rb") as handle:
|
|
9 |
index = pickle.load(handle)
|
10 |
|
11 |
# Load model for computing embeddings.
|
12 |
-
feature_extractor = AutoFeatureExtractor.from_pretrained("sasha/autotrain-
|
13 |
-
model = AutoModel.from_pretrained("sasha/autotrain-
|
14 |
|
15 |
# Candidate images.
|
16 |
-
dataset = load_dataset("sasha/
|
17 |
ds = dataset["train"]
|
18 |
|
19 |
|
@@ -25,7 +25,7 @@ def query(image, top_k=4):
|
|
25 |
inx = results[0][0].tolist()
|
26 |
logits = results[1][0].tolist()
|
27 |
images = ds.select(inx)["image"]
|
28 |
-
captions = ds.select(inx)["
|
29 |
images_with_captions = [(i, c) for i, c in zip(images,captions)]
|
30 |
labels_with_probs = dict(zip(captions,logits))
|
31 |
labels_with_probs = {k: 1- v for k, v in labels_with_probs.items()}
|
|
|
9 |
index = pickle.load(handle)
|
10 |
|
11 |
# Load model for computing embeddings.
|
12 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained("sasha/autotrain-sea-slug-similarity-2498977005")
|
13 |
+
model = AutoModel.from_pretrained("sasha/autotrain-sea-slug-similarity-2498977005")
|
14 |
|
15 |
# Candidate images.
|
16 |
+
dataset = load_dataset("sasha/australian_sea_slugs")
|
17 |
ds = dataset["train"]
|
18 |
|
19 |
|
|
|
25 |
inx = results[0][0].tolist()
|
26 |
logits = results[1][0].tolist()
|
27 |
images = ds.select(inx)["image"]
|
28 |
+
captions = ds.select(inx)["label"]
|
29 |
images_with_captions = [(i, c) for i, c in zip(images,captions)]
|
30 |
labels_with_probs = dict(zip(captions,logits))
|
31 |
labels_with_probs = {k: 1- v for k, v in labels_with_probs.items()}
|
slugs_index_1024_cosine.pickle
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bdfd6d5f6f4b429f58395bd9225118f0f13bfc654ba2a8c1fdaef243792ddfcd
|
3 |
+
size 20848578
|