Spaces:
Sleeping
Sleeping
Update search_ocean.py
Browse files- search_ocean.py +7 -0
search_ocean.py
CHANGED
@@ -8,6 +8,13 @@ import torch
|
|
8 |
text_index = faiss.read_index("text_recipes_test_br_00.ocean")
|
9 |
image_index = faiss.read_index("image_recipes_test_br_00.ocean")
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
# Initialize models for text and image processing
|
12 |
text_encoder = SentenceTransformer("sentence-transformers/all-MiniLM-L12-v2")
|
13 |
clip_model, clip_preprocess = clip.load("ViT-B/32", device="cpu")
|
|
|
8 |
text_index = faiss.read_index("text_recipes_test_br_00.ocean")
|
9 |
image_index = faiss.read_index("image_recipes_test_br_00.ocean")
|
10 |
|
11 |
+
# Load metadata
|
12 |
+
with open("text_metadata.json", "r", encoding="utf-8") as f:
|
13 |
+
text_metadata = json.load(f)
|
14 |
+
|
15 |
+
with open("image_metadata.json", "r", encoding="utf-8") as f:
|
16 |
+
image_metadata = json.load(f)
|
17 |
+
|
18 |
# Initialize models for text and image processing
|
19 |
text_encoder = SentenceTransformer("sentence-transformers/all-MiniLM-L12-v2")
|
20 |
clip_model, clip_preprocess = clip.load("ViT-B/32", device="cpu")
|