Kaori1707 commited on
Commit
b7478bf
1 Parent(s): 91c4851

update app

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -43,14 +43,6 @@ def detection(image):
43
  s = f"Found {len(probs)} objects"
44
  return image, s
45
 
46
- def video_detection(frames):
47
- out = cv2.VideoWriter('outpy.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 30, (640, 320))
48
- for frame in frames:
49
- out.write(frame)
50
-
51
- out.release()
52
- return "outpy.avi"
53
-
54
 
55
  title = " AISeed AI Application Demo "
56
  description = "# A Demo of Deep Learning for Object Detection"
@@ -82,11 +74,14 @@ with gr.Blocks() as demo:
82
 
83
  with gr.Tab("for streaming"):
84
  with gr.Row():
 
 
85
  with gr.Column():
86
- input_video = gr.Video(source="webcam", label="Input")
87
- btn3 = gr.Button(value="Who wears mask?")
88
- output_video = gr.Video(label="Output Video")
89
- btn3.click(video_detection, inputs=[input_video], outputs=[output_video])
 
90
 
91
 
92
  if __name__ == "__main__":
 
43
  s = f"Found {len(probs)} objects"
44
  return image, s
45
 
 
 
 
 
 
 
 
 
46
 
47
  title = " AISeed AI Application Demo "
48
  description = "# A Demo of Deep Learning for Object Detection"
 
74
 
75
  with gr.Tab("for streaming"):
76
  with gr.Row():
77
+
78
+ input_video = gr.Image(source="webcam", streaming=True)
79
  with gr.Column():
80
+ output_video = gr.Image(label="Video")
81
+ text1 = gr.Textbox(label="Number of objects")
82
+ input_video.change(detection, inputs = [input_video], outputs=[output_video, text1], show_progress=False)
83
+
84
+
85
 
86
 
87
  if __name__ == "__main__":