leedoming commited on
Commit
ee78aad
·
verified ·
1 Parent(s): c701106

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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', 'distances']
320
  )
321
 
322
- if not results or not results['metadatas'] or not results['distances']:
323
  logger.warning("No results returned from ChromaDB")
324
  return []
325
 
326
  similar_items = []
327
- for metadata, distance in zip(results['metadatas'][0], results['distances'][0]):
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()