Update app.py
Browse files
app.py
CHANGED
|
@@ -250,12 +250,15 @@ def recognize_face_optimal_ui():
|
|
| 250 |
result_parts = result.split(",")
|
| 251 |
if len(result_parts) >= 2:
|
| 252 |
name = result_parts[0]
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
|
|
|
|
|
|
|
|
|
| 259 |
else:
|
| 260 |
st.error("Invalid result format.")
|
| 261 |
|
|
|
|
| 250 |
result_parts = result.split(",")
|
| 251 |
if len(result_parts) >= 2:
|
| 252 |
name = result_parts[0]
|
| 253 |
+
try:
|
| 254 |
+
similarity_score = float(result_parts[1])
|
| 255 |
+
if len(result_parts) == 3:
|
| 256 |
+
email = result_parts[2]
|
| 257 |
+
st.write(f"Best match: {name} with a similarity score of {1 - similarity_score:.2%}. Email: {email}")
|
| 258 |
+
else:
|
| 259 |
+
st.write(f"Best match: {name} with a similarity score of {1 - similarity_score:.2%}.")
|
| 260 |
+
except ValueError:
|
| 261 |
+
st.error("Invalid similarity score format.")
|
| 262 |
else:
|
| 263 |
st.error("Invalid result format.")
|
| 264 |
|