0x70DA commited on
Commit
e870457
·
1 Parent(s): c6b7076

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -19,8 +19,9 @@ def predict(img):
19
  cropped_face = img[y : y + h, x : x + w]
20
  # Convert the cropped image to a PIL image
21
  pil_image = Image.fromarray(cv2.cvtColor(cropped_face, cv2.COLOR_BGR2RGB))
22
- pred = model(pil_image)
23
- return {o["label"]: o["score"] for o in pred}
 
24
 
25
 
26
  demo = gr.Interface(
 
19
  cropped_face = img[y : y + h, x : x + w]
20
  # Convert the cropped image to a PIL image
21
  pil_image = Image.fromarray(cv2.cvtColor(cropped_face, cv2.COLOR_BGR2RGB))
22
+ pred = model(pil_image)
23
+ return {o["label"]: o["score"] for o in pred}
24
+ return RuntimeError("No faces detected.")
25
 
26
 
27
  demo = gr.Interface(