Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -87,11 +87,14 @@ def retrieve_document(query):
|
|
87 |
print(f"Error fetching metadata: {metadata_.status_code} - {metadata_.text}")
|
88 |
return None
|
89 |
|
90 |
-
|
91 |
-
# Load FAISS index from response content
|
92 |
-
index = faiss.
|
93 |
print(f"Successfully loaded FAISS index with {index.ntotal} vectors.")
|
94 |
|
|
|
|
|
|
|
95 |
except Exception as e:
|
96 |
print(f"Error loading FAISS index: {e}")
|
97 |
return None
|
|
|
87 |
print(f"Error fetching metadata: {metadata_.status_code} - {metadata_.text}")
|
88 |
return None
|
89 |
|
90 |
+
try:
|
91 |
+
# Load FAISS index from binary response content
|
92 |
+
index = faiss.read_index_from_buffer(embeddings_.content)
|
93 |
print(f"Successfully loaded FAISS index with {index.ntotal} vectors.")
|
94 |
|
95 |
+
# Now you can perform retrieval using `index.search()`
|
96 |
+
# return index
|
97 |
+
|
98 |
except Exception as e:
|
99 |
print(f"Error loading FAISS index: {e}")
|
100 |
return None
|