Matan Kriel commited on
Commit
7b4d8e5
·
1 Parent(s): 1458622

updated app

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -75,20 +75,18 @@ def find_best_matches(user_image):
75
  display_name = f"{row['name']} (Match: {int(score*100)}%)"
76
  result_text += f"### #{i}: {display_name}\n\n"
77
 
78
- # Load Image
79
  try:
80
  if os.path.exists(row['image_path']):
81
  img = Image.open(row['image_path'])
82
  gallery_images.append((img, display_name))
83
  else:
84
- gallery_images.append((None, display_name))
85
- except:
86
- gallery_images.append((None, display_name))
87
 
88
- # Pad with empty data if we found fewer than 3 matches
89
- while len(gallery_images) < 3:
90
- gallery_images.append((None, "No Match"))
91
- result_text += "### No Match\n\n"
92
 
93
  return gallery_images, result_text
94
 
 
75
  display_name = f"{row['name']} (Match: {int(score*100)}%)"
76
  result_text += f"### #{i}: {display_name}\n\n"
77
 
78
+ # Load Image - only add to gallery if image exists and loads successfully
79
  try:
80
  if os.path.exists(row['image_path']):
81
  img = Image.open(row['image_path'])
82
  gallery_images.append((img, display_name))
83
  else:
84
+ result_text += f"⚠️ Image file not found: {row['image_path']}\n\n"
85
+ except Exception as img_error:
86
+ result_text += f"⚠️ Could not load image: {str(img_error)}\n\n"
87
 
88
+ # Don't pad with None - Gallery can't handle None images
89
+ # Just return what we have
 
 
90
 
91
  return gallery_images, result_text
92