leedoming commited on
Commit
85a8225
โ€ข
1 Parent(s): fd87108

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -326,7 +326,7 @@ def search_similar_items(features, top_k=10):
326
  similar_items = []
327
  for metadata, distance in zip(results['metadatas'][0], results['distances'][0]):
328
  try:
329
- similarity_score = 1 / (1 + float(distance))
330
  item_data = metadata.copy()
331
  item_data['similarity_score'] = similarity_score
332
  similar_items.append(item_data)
@@ -361,7 +361,7 @@ def show_similar_items(similar_items):
361
  st.image(item['image_url'], use_column_width=True)
362
 
363
  # ์œ ์‚ฌ๋„ ์ ์ˆ˜๋ฅผ ํผ์„ผํŠธ๋กœ ํ‘œ์‹œ
364
- similarity_percent = item['similarity_score'] * 100
365
  st.markdown(f"**Similarity: {similarity_percent:.1f}%**")
366
 
367
  st.write(f"Brand: {item.get('brand', 'Unknown')}")
 
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()
331
  item_data['similarity_score'] = similarity_score
332
  similar_items.append(item_data)
 
361
  st.image(item['image_url'], use_column_width=True)
362
 
363
  # ์œ ์‚ฌ๋„ ์ ์ˆ˜๋ฅผ ํผ์„ผํŠธ๋กœ ํ‘œ์‹œ
364
+ similarity_percent = item['similarity_score']
365
  st.markdown(f"**Similarity: {similarity_percent:.1f}%**")
366
 
367
  st.write(f"Brand: {item.get('brand', 'Unknown')}")