xktan commited on
Commit
a2fb89f
·
verified ·
1 Parent(s): 5e308f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -11
app.py CHANGED
@@ -544,7 +544,7 @@ def analyze_face_features(image):
544
  results = DeepFace.analyze(
545
  img_path=image_cv,
546
  actions=['emotion'],
547
- detector_backend='retinaface',
548
  enforce_detection=False
549
  )
550
 
@@ -563,7 +563,7 @@ def analyze_face_features(image):
563
  "surprise": 0,
564
  "neutral": 0}
565
 
566
- # If no faces meet confidence threshold, return zeros
567
  if not results:
568
  return {
569
  "angry": 0,
@@ -606,15 +606,6 @@ def analyze_face_features(image):
606
  "neutral": avg_emotions["neutral"],
607
  }
608
 
609
- result = {
610
- "angry": results,
611
- "disgust": 0,
612
- "fear": 0,
613
- "happy": 0,
614
- "sad": 0,
615
- "surprise": 0,
616
- "neutral": 0
617
- }
618
 
619
  return result
620
 
 
544
  results = DeepFace.analyze(
545
  img_path=image_cv,
546
  actions=['emotion'],
547
+ detector_backend='mtcnn',
548
  enforce_detection=False
549
  )
550
 
 
563
  "surprise": 0,
564
  "neutral": 0}
565
 
566
+ # If no faces, return zeros
567
  if not results:
568
  return {
569
  "angry": 0,
 
606
  "neutral": avg_emotions["neutral"],
607
  }
608
 
 
 
 
 
 
 
 
 
 
609
 
610
  return result
611