Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,8 +88,12 @@ def retrieve_document(query):
|
|
| 88 |
return None
|
| 89 |
|
| 90 |
try:
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
print(f"Successfully loaded FAISS index with {index.ntotal} vectors.")
|
| 94 |
|
| 95 |
# Now you can perform retrieval using `index.search()`
|
|
|
|
| 88 |
return None
|
| 89 |
|
| 90 |
try:
|
| 91 |
+
# Convert response content to a byte stream
|
| 92 |
+
byte_stream = io.BytesIO(embeddings_.content)
|
| 93 |
+
|
| 94 |
+
# Load FAISS index from byte stream
|
| 95 |
+
index = faiss.deserialize_index(byte_stream.read())
|
| 96 |
+
|
| 97 |
print(f"Successfully loaded FAISS index with {index.ntotal} vectors.")
|
| 98 |
|
| 99 |
# Now you can perform retrieval using `index.search()`
|