Spaces:
Sleeping
Sleeping
updated helper.py
Browse files
helper.py
CHANGED
@@ -108,7 +108,7 @@ def search(query, df, limit, offset, scoring_func, search_in_images):
|
|
108 |
|
109 |
# Calculate the cosine similarity between the query vector and each image vector
|
110 |
query_vector = query_vector[0, :].detach().numpy() # Detach and convert to a NumPy array
|
111 |
-
image_vectors =
|
112 |
cosine_similarities = cosine_similarity([query_vector], image_vectors)
|
113 |
|
114 |
# Get the top K indices of the most similar image vectors
|
|
|
108 |
|
109 |
# Calculate the cosine similarity between the query vector and each image vector
|
110 |
query_vector = query_vector[0, :].detach().numpy() # Detach and convert to a NumPy array
|
111 |
+
image_vectors = image_vectors.detach().numpy() # Convert the image vectors to a NumPy array
|
112 |
cosine_similarities = cosine_similarity([query_vector], image_vectors)
|
113 |
|
114 |
# Get the top K indices of the most similar image vectors
|