Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,9 +28,9 @@ import numpy as np
|
|
| 28 |
import tempfile
|
| 29 |
from pathlib import Path
|
| 30 |
|
| 31 |
-
# Update the numpy version check
|
| 32 |
-
if not hasattr(np, '__version__') or tuple(map(int, np.__version__.split('.')))
|
| 33 |
-
print(f"Warning: Using numpy version {np.__version__}.
|
| 34 |
|
| 35 |
# Configure logging
|
| 36 |
logging.basicConfig(level=logging.INFO)
|
|
@@ -104,9 +104,16 @@ def load_sentence_transformer():
|
|
| 104 |
# Load FAISS index
|
| 105 |
def load_faiss_index():
|
| 106 |
print("Loading FAISS index...")
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
# Load dataset
|
| 112 |
def load_dataset():
|
|
|
|
| 28 |
import tempfile
|
| 29 |
from pathlib import Path
|
| 30 |
|
| 31 |
+
# Update the numpy version check
|
| 32 |
+
if not hasattr(np, '__version__') or tuple(map(int, np.__version__.split('.'))) != (1, 23, 5):
|
| 33 |
+
print(f"Warning: Using numpy version {np.__version__}. Expected version 1.23.5")
|
| 34 |
|
| 35 |
# Configure logging
|
| 36 |
logging.basicConfig(level=logging.INFO)
|
|
|
|
| 104 |
# Load FAISS index
|
| 105 |
def load_faiss_index():
|
| 106 |
print("Loading FAISS index...")
|
| 107 |
+
try:
|
| 108 |
+
index = faiss.read_index(faiss_index_path)
|
| 109 |
+
# Ensure the index is on CPU
|
| 110 |
+
if hasattr(faiss, 'StandardGpuResources'):
|
| 111 |
+
index = faiss.index_gpu_to_cpu(index)
|
| 112 |
+
print("FAISS index loaded successfully.")
|
| 113 |
+
return index
|
| 114 |
+
except Exception as e:
|
| 115 |
+
print(f"Error loading FAISS index: {str(e)}")
|
| 116 |
+
raise
|
| 117 |
|
| 118 |
# Load dataset
|
| 119 |
def load_dataset():
|