Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -316,15 +316,15 @@ def search_similar_items(features, top_k=10):
|
|
316 |
results = search_collection.query(
|
317 |
query_embeddings=[features.tolist()],
|
318 |
n_results=top_k,
|
319 |
-
include=['metadatas', '
|
320 |
)
|
321 |
|
322 |
-
if not results or not results['metadatas'] or not results['
|
323 |
logger.warning("No results returned from ChromaDB")
|
324 |
return []
|
325 |
|
326 |
similar_items = []
|
327 |
-
for metadata, distance in zip(results['metadatas'][0], results['
|
328 |
try:
|
329 |
similarity_score = distance
|
330 |
item_data = metadata.copy()
|
|
|
316 |
results = search_collection.query(
|
317 |
query_embeddings=[features.tolist()],
|
318 |
n_results=top_k,
|
319 |
+
include=['metadatas', 'scores']
|
320 |
)
|
321 |
|
322 |
+
if not results or not results['metadatas'] or not results['scores']:
|
323 |
logger.warning("No results returned from ChromaDB")
|
324 |
return []
|
325 |
|
326 |
similar_items = []
|
327 |
+
for metadata, distance in zip(results['metadatas'][0], results['scores'][0]):
|
328 |
try:
|
329 |
similarity_score = distance
|
330 |
item_data = metadata.copy()
|