Update app.py
Browse files
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 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 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:
|