Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import hf_hub_download
|
2 |
+
import cv2
|
3 |
+
import gradio as gr
|
4 |
+
from PIL import Image
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
model_path = hf_hub_download(repo_id="arnabdhar/YOLOv8-Face-Detection", filename="model.pt")
|
8 |
+
model = YOLO(model_path)
|
9 |
+
|
10 |
+
def detect_faces(image):
|
11 |
+
|
12 |
+
return (image_np,im)
|
13 |
+
|
14 |
+
interface = gr.Interface(
|
15 |
+
fn=detect_faces,
|
16 |
+
inputs=gr.Image(label='Upload Image'),
|
17 |
+
outputs=[gr.Image(label='Original'),gr.Image(label='Deep learning')],
|
18 |
+
title="Face Detection Deep Learning",
|
19 |
+
description="Upload an image, and the model will detect faces and draw bounding boxes around them.",
|
20 |
+
)
|
21 |
+
interface.launch()
|