Penality commited on
Commit
8aa0dab
·
verified ·
1 Parent(s): a5f4249

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -86,15 +86,9 @@ def retrieve_document(query):
86
  print(f"Error fetching metadata: {metadata_.status_code} - {metadata_.text}")
87
  return None
88
 
89
- # Save the FAISS file temporarily
90
- with tempfile.NamedTemporaryFile(delete=False) as temp_file:
91
- for chunk in embeddings_.iter_content(chunk_size=8192):
92
- temp_file.write(chunk)
93
- temp_path = temp_file.name # Store file path
94
-
95
  try:
96
- # Load FAISS index from file
97
- index = faiss.read_index(embeddings_file)
98
  print(f"Successfully loaded FAISS index with {index.ntotal} vectors.")
99
 
100
  except Exception as e:
 
86
  print(f"Error fetching metadata: {metadata_.status_code} - {metadata_.text}")
87
  return None
88
 
 
 
 
 
 
 
89
  try:
90
+ # Load FAISS index from response content (treat as file-like object)
91
+ index = faiss.read_index(io.BytesIO(embeddings_.content))
92
  print(f"Successfully loaded FAISS index with {index.ntotal} vectors.")
93
 
94
  except Exception as e: