rosebe commited on
Commit
2e0ea1a
·
1 Parent(s): fd73203

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -1,6 +1,9 @@
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):
@@ -10,7 +13,11 @@ def detect_faces(image):
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)
 
1
  import gradio as gr
2
  import torch
3
 
4
+ def snap(video):
5
+ return [video]
6
+
7
  model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
8
  # Define the face detector function
9
  def detect_faces(image):
 
13
  return results.render()[0]
14
 
15
  # Create a Gradio interface
16
+ iface = gr.Interface(
17
+ snap,
18
+ [gr.Video(source="webcam")],
19
+ ["video"],
20
+ )
21
 
22
  # Launch the interface
23
  iface.launch(debug=True)