Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,7 @@ def search(query):
|
|
28 |
query_vector = model.encode([query])[0].astype('float32')
|
29 |
|
30 |
# Search the FAISS index
|
31 |
-
distances, indices = index.search(np.array([query_vector]), k=
|
32 |
|
33 |
# Return corresponding content for the top results using the indices
|
34 |
results = [f"Content: {content_column[i]}\nDistance: {d:.4f}" for i, d in zip(indices[0], distances[0])]
|
|
|
28 |
query_vector = model.encode([query])[0].astype('float32')
|
29 |
|
30 |
# Search the FAISS index
|
31 |
+
distances, indices = index.search(np.array([query_vector]), k=1) # Search for top 5 closest vectors
|
32 |
|
33 |
# Return corresponding content for the top results using the indices
|
34 |
results = [f"Content: {content_column[i]}\nDistance: {d:.4f}" for i, d in zip(indices[0], distances[0])]
|