Spaces:
Runtime error
Runtime error
add features
Browse files- app.py +1 -1
- assets/image_features_norm_2.pkl +3 -0
- utils.py +0 -11
app.py
CHANGED
|
@@ -18,7 +18,7 @@ model = imagebind_model.imagebind_huge(pretrained=True)
|
|
| 18 |
model.eval()
|
| 19 |
model.to(device)
|
| 20 |
|
| 21 |
-
image_features = pickle.load(open("./assets/
|
| 22 |
image_paths = pickle.load(open("./assets/image_paths.pkl","rb"))
|
| 23 |
|
| 24 |
|
|
|
|
| 18 |
model.eval()
|
| 19 |
model.to(device)
|
| 20 |
|
| 21 |
+
image_features = pickle.load(open("./assets/image_features_norm_2.pkl","rb"))
|
| 22 |
image_paths = pickle.load(open("./assets/image_paths.pkl","rb"))
|
| 23 |
|
| 24 |
|
assets/image_features_norm_2.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:414236d649565bf26c4dfaac062886f7c73ba60d07029a52f2eb44aa31ff2a38
|
| 3 |
+
size 33172
|
utils.py
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import pickle
|
| 3 |
-
|
| 4 |
-
# teste = pickle.load(open("df_to_search.pkl","rb"))
|
| 5 |
-
def calculate_similarity():
|
| 6 |
-
image_features = embeddings[ModalityType.VISION]
|
| 7 |
-
text_features = embeddings[ModalityType.TEXT]
|
| 8 |
-
|
| 9 |
-
image_features /= image_features.norm(dim=-1, keepdim=True)
|
| 10 |
-
text_features /= text_features.norm(dim=-1, keepdim=True)
|
| 11 |
-
similarity = text_features.cpu().numpy() @ image_features.cpu().numpy().T
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|