Penality commited on
Commit
2af8ac7
·
verified ·
1 Parent(s): dd8ef37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -88,8 +88,12 @@ def retrieve_document(query):
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()`
 
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()`