nowimsoham commited on
Commit
25a5f64
·
1 Parent(s): 0391588

confidence reinstated

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -31,8 +31,9 @@ def detect_emotion(image):
31
  face_features = extract_features(face_image)
32
  prediction = model.predict(face_features)
33
  prediction_label = labels[prediction.argmax()]
34
- confidence = np.max(prediction)
35
- return {"label": prediction_label, "confidence": confidence}
 
36
  #return prediction_label
37
  else:
38
  return "No face detected" # Handle no face case
 
31
  face_features = extract_features(face_image)
32
  prediction = model.predict(face_features)
33
  prediction_label = labels[prediction.argmax()]
34
+ confidence = np.max(prediction)*100
35
+ confidence = f"{confidence:.2f}%"
36
+ return {"label": prediction_label, "Confidence": confidence}
37
  #return prediction_label
38
  else:
39
  return "No face detected" # Handle no face case