Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
-
def detect_faces(image):
|
3 |
|
4 |
-
|
5 |
-
from ultralytics import YOLO
|
6 |
-
from supervision import Detections
|
7 |
-
import cv2
|
8 |
-
|
9 |
model_path = hf_hub_download(repo_id="arnabdhar/YOLOv8-Face-Detection", filename="model.pt")
|
10 |
model = YOLO(model_path)
|
11 |
|
@@ -14,7 +16,6 @@ def detect_faces(image):
|
|
14 |
|
15 |
for i in results:
|
16 |
im = cv2.rectangle(image, (int(i[0][0]),int(i[0][1])), (int(i[0][2]),int(i[0][3])), (0,0,255), 2)
|
17 |
-
|
18 |
return im
|
19 |
|
20 |
interface = gr.Interface(
|
|
|
1 |
+
from huggingface_hub import hf_hub_download
|
2 |
+
from ultralytics import YOLO
|
3 |
+
from supervision import Detections
|
4 |
+
import cv2
|
5 |
+
import gradio as gr
|
6 |
+
from PIL import Image
|
7 |
+
import numpy as np
|
8 |
|
|
|
9 |
|
10 |
+
def detect_faces(image):
|
|
|
|
|
|
|
|
|
11 |
model_path = hf_hub_download(repo_id="arnabdhar/YOLOv8-Face-Detection", filename="model.pt")
|
12 |
model = YOLO(model_path)
|
13 |
|
|
|
16 |
|
17 |
for i in results:
|
18 |
im = cv2.rectangle(image, (int(i[0][0]),int(i[0][1])), (int(i[0][2]),int(i[0][3])), (0,0,255), 2)
|
|
|
19 |
return im
|
20 |
|
21 |
interface = gr.Interface(
|