RajaThor commited on
Commit
75ec68d
·
verified ·
1 Parent(s): 6c891cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
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
- similarity_score = float(result_parts[1])
254
- if len(result_parts) == 3:
255
- email = result_parts[2]
256
- st.write(f"Best match: {name} with a similarity score of {1 - similarity_score:.2%}. Email: {email}")
257
- else:
258
- st.write(f"Best match: {name} with a similarity score of {1 - similarity_score:.2%}.")
 
 
 
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