Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -78,9 +78,15 @@ def initialize_faiss():
|
|
78 |
index = faiss.index_cpu_to_all_gpus(index)
|
79 |
else:
|
80 |
print("CUDA not available, using CPU.")
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
82 |
return index
|
83 |
|
|
|
84 |
index = initialize_faiss()
|
85 |
|
86 |
# Function to upload document
|
|
|
78 |
index = faiss.index_cpu_to_all_gpus(index)
|
79 |
else:
|
80 |
print("CUDA not available, using CPU.")
|
81 |
+
|
82 |
+
# Save the FAISS index to the file (make sure it gets saved)
|
83 |
+
print(f"Saving FAISS index to {faiss_index_file}.")
|
84 |
+
faiss.write_index(index, faiss_index_file)
|
85 |
+
print(f"FAISS index saved to {faiss_index_file}.")
|
86 |
+
|
87 |
return index
|
88 |
|
89 |
+
# Call to initialize and save the FAISS index
|
90 |
index = initialize_faiss()
|
91 |
|
92 |
# Function to upload document
|