Spaces:
Runtime error
Runtime error
update app
Browse files
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 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
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__":
|