Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from PIL import Image
|
|
| 7 |
import numpy as np
|
| 8 |
from transformers import pipeline
|
| 9 |
|
| 10 |
-
pipe = pipeline("image-classification", model="NTQAI/pedestrian_gender_recognition")
|
| 11 |
model_path = hf_hub_download(repo_id="arnabdhar/YOLOv8-Face-Detection", filename="model.pt")
|
| 12 |
model = YOLO(model_path)
|
| 13 |
|
|
@@ -26,14 +26,14 @@ def detect_faces(image):
|
|
| 26 |
for (x, y, w, h) in faces:
|
| 27 |
cv2.rectangle(image_np, (x, y), (x+w, y+h), (0, 255, 0), 2)
|
| 28 |
|
| 29 |
-
label_out = pipe(image)
|
| 30 |
|
| 31 |
-
return (image_np,im
|
| 32 |
|
| 33 |
interface = gr.Interface(
|
| 34 |
fn=detect_faces,
|
| 35 |
inputs=gr.Image(label='Upload Image'),
|
| 36 |
-
outputs=[gr.Image(label='Original'),gr.Image(label='Deep learning')
|
| 37 |
title="Face Detection Deep Learning",
|
| 38 |
description="Upload an image, and the model will detect faces and draw bounding boxes around them.",
|
| 39 |
)
|
|
|
|
| 7 |
import numpy as np
|
| 8 |
from transformers import pipeline
|
| 9 |
|
| 10 |
+
#pipe = pipeline("image-classification", model="NTQAI/pedestrian_gender_recognition")
|
| 11 |
model_path = hf_hub_download(repo_id="arnabdhar/YOLOv8-Face-Detection", filename="model.pt")
|
| 12 |
model = YOLO(model_path)
|
| 13 |
|
|
|
|
| 26 |
for (x, y, w, h) in faces:
|
| 27 |
cv2.rectangle(image_np, (x, y), (x+w, y+h), (0, 255, 0), 2)
|
| 28 |
|
| 29 |
+
#label_out = pipe(image)
|
| 30 |
|
| 31 |
+
return (image_np,im)#,label_out[0]['label'])
|
| 32 |
|
| 33 |
interface = gr.Interface(
|
| 34 |
fn=detect_faces,
|
| 35 |
inputs=gr.Image(label='Upload Image'),
|
| 36 |
+
outputs=[gr.Image(label='Original'),gr.Image(label='Deep learning')],
|
| 37 |
title="Face Detection Deep Learning",
|
| 38 |
description="Upload an image, and the model will detect faces and draw bounding boxes around them.",
|
| 39 |
)
|