Penality commited on
Commit
81646ae
·
verified ·
1 Parent(s): 7fa1089

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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
- try:
91
- # Load FAISS index from response content (treat as file-like object)
92
- index = faiss.read_index(io.BytesIO(embeddings_.content))
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