RajaThor commited on
Commit
afe49ea
·
verified ·
1 Parent(s): 4485c3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -191,16 +191,11 @@ def recognize_face_optimal(image_path):
191
  if matches:
192
  best_match = min(matches, key=lambda x: x[1])
193
  best_name, best_score = best_match
194
-
195
- # Check if the best match is within a reasonable range of similarity scores
196
- if best_score < 0.6: # Adjust the threshold as needed
197
- info = ref.child(best_name).child("info").get()
198
- insta_handle = info["instagram_handle"]
199
- insta_link = info["instagram_link"]
200
- insta_link_html = f'<a href="{insta_link}" target="_blank"><font color="red">{insta_handle}</font></a>'
201
- return f"Best match: {best_name} with a similarity score of {1 - best_score:.2%}. Insta handle: {insta_link_html}"
202
- else:
203
- return "No suitable match found."
204
  else:
205
  return "Face not found in the database."
206
  except Exception as e:
 
191
  if matches:
192
  best_match = min(matches, key=lambda x: x[1])
193
  best_name, best_score = best_match
194
+ info = ref.child(best_name).child("info").get()
195
+ insta_handle = info["instagram_handle"]
196
+ insta_link = info["instagram_link"]
197
+ insta_link_html = f'<a href="{insta_link}" target="_blank"><font color="red">{insta_handle}</font></a>'
198
+ return f"Best match: {best_name} with a similarity score of {1 - best_score:.2%}. Insta handle: {insta_link_html}"
 
 
 
 
 
199
  else:
200
  return "Face not found in the database."
201
  except Exception as e: