Spaces:
Sleeping
Sleeping
Commit ·
25a5f64
1
Parent(s): 0391588
confidence reinstated
Browse files
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 |
-
|
|
|
|
| 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
|