YALCINKAYA commited on
Commit
744513e
·
verified ·
1 Parent(s): c651a43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -128,9 +128,7 @@ def load_document_store():
128
  # Add embeddings to FAISS index
129
  index.add_with_ids(embeddings, np.array(list(document_store.keys()), dtype=np.int64))
130
  print(f"Added {len(all_texts)} document embeddings to FAISS index.")
131
-
132
- # Load document store and index the documents
133
- load_document_store()
134
 
135
  # Function to upload document
136
  def upload_document(file_path, embed_model):
@@ -223,6 +221,10 @@ def handle_upload():
223
  try:
224
  # Save the file to the upload directory
225
  file.save(file_path)
 
 
 
 
226
  except Exception as e:
227
  return jsonify({"error": f"Error saving file: {e}"}), 502
228
 
 
128
  # Add embeddings to FAISS index
129
  index.add_with_ids(embeddings, np.array(list(document_store.keys()), dtype=np.int64))
130
  print(f"Added {len(all_texts)} document embeddings to FAISS index.")
131
+
 
 
132
 
133
  # Function to upload document
134
  def upload_document(file_path, embed_model):
 
221
  try:
222
  # Save the file to the upload directory
223
  file.save(file_path)
224
+
225
+ # Now that the document is uploaded, call load_document_store()
226
+ print(f"File uploaded successfully. Calling load_document_store()...")
227
+ load_document_store()
228
  except Exception as e:
229
  return jsonify({"error": f"Error saving file: {e}"}), 502
230