Spaces:
Runtime error
Runtime error
File size: 420 Bytes
dfc785e c17e36f dfc785e c17e36f dfc785e c17e36f f0e607c c17e36f 0ec21e2 c17e36f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import faiss
import numpy as np
# Load FAISS index
FAISS_PATH = "asa_faiss.index"
index = faiss.read_index(FAISS_PATH)
# Example query vector (random, replace with actual embedding from your model)
query_vector = np.random.rand(1, index.d).astype('float32')
# Search FAISS index
D, I = index.search(query_vector, k=1) # k=1 means get 1 nearest neighbor
print(f"Closest match index: {I[0][0]}, Distance: {D[0][0]}")
|