Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
23 |
-
|
|
|
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(
|