Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,16 @@
|
|
1 |
-
# import gradio as gr
|
2 |
-
# import torch
|
3 |
-
|
4 |
-
# model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
|
5 |
-
# # Define the face detector function
|
6 |
-
# def detect_faces(image):
|
7 |
-
# # Loading in yolov5s - you can switch to larger models such as yolov5m or yolov5l, or smaller such as yolov5n
|
8 |
-
# results = model(image)
|
9 |
-
|
10 |
-
# return results.render()[0]
|
11 |
-
|
12 |
-
# # Create a Gradio interface
|
13 |
-
# iface = gr.Interface(fn=detect_faces, inputs="image", outputs="image")
|
14 |
-
|
15 |
-
# # Launch the interface
|
16 |
-
# iface.launch(debug=True)
|
17 |
-
|
18 |
import gradio as gr
|
|
|
19 |
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
return [image, video]
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
[gr.Image(source="webcam", tool=None), gr.Video(source="webcam")],
|
28 |
-
["image", "video"],
|
29 |
-
)
|
30 |
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
|
4 |
+
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
|
5 |
+
# Define the face detector function
|
6 |
+
def detect_faces(image):
|
7 |
+
# Loading in yolov5s - you can switch to larger models such as yolov5m or yolov5l, or smaller such as yolov5n
|
8 |
+
results = model(image)
|
9 |
|
10 |
+
return results.render()[0]
|
|
|
|
|
11 |
|
12 |
+
# Create a Gradio interface
|
13 |
+
iface = gr.Interface(fn=detect_faces, inputs=gr.Video(source="webcam"), outputs="image")
|
|
|
|
|
|
|
14 |
|
15 |
+
# Launch the interface
|
16 |
+
iface.launch(debug=True)
|