Spaces:
Runtime error
Runtime error
blocks
Browse files
app.py
CHANGED
|
@@ -96,6 +96,13 @@ def show_tracking(video_content):
|
|
| 96 |
|
| 97 |
return out_file
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
block = gr.Blocks()
|
| 100 |
with block:
|
| 101 |
with gr.Column():
|
|
@@ -103,7 +110,7 @@ with block:
|
|
| 103 |
with gr.Column():
|
| 104 |
with gr.Row():
|
| 105 |
with gr.Column():
|
| 106 |
-
video_input = gr.Video(source="upload", type="filepath", height=
|
| 107 |
with gr.Row():
|
| 108 |
submit_detect_file = gr.Button("Detect and track objects", variant="primary")
|
| 109 |
|
|
@@ -115,7 +122,7 @@ with block:
|
|
| 115 |
with gr.Column():
|
| 116 |
with gr.Row():
|
| 117 |
with gr.Column():
|
| 118 |
-
webcam_input = gr.Video(source="webcam", height=
|
| 119 |
|
| 120 |
with gr.Row():
|
| 121 |
submit_detect_web = gr.Button("Detect and track objects", variant="primary")
|
|
@@ -135,10 +142,12 @@ with block:
|
|
| 135 |
|
| 136 |
|
| 137 |
# From file
|
| 138 |
-
submit_detect_file.click(fn=
|
| 139 |
inputs= video_input,
|
| 140 |
outputs = video_output4,
|
| 141 |
-
queue=True
|
|
|
|
|
|
|
| 142 |
|
| 143 |
|
| 144 |
submit_detect_web.click(fn=show_tracking,
|
|
|
|
| 96 |
|
| 97 |
return out_file
|
| 98 |
|
| 99 |
+
def track_blocks(video_content):
|
| 100 |
+
files = []
|
| 101 |
+
for v in video_content:
|
| 102 |
+
files.append(show_tracking(v))
|
| 103 |
+
|
| 104 |
+
return files
|
| 105 |
+
|
| 106 |
block = gr.Blocks()
|
| 107 |
with block:
|
| 108 |
with gr.Column():
|
|
|
|
| 110 |
with gr.Column():
|
| 111 |
with gr.Row():
|
| 112 |
with gr.Column():
|
| 113 |
+
video_input = gr.Video(source="upload", type="filepath", height=256)
|
| 114 |
with gr.Row():
|
| 115 |
submit_detect_file = gr.Button("Detect and track objects", variant="primary")
|
| 116 |
|
|
|
|
| 122 |
with gr.Column():
|
| 123 |
with gr.Row():
|
| 124 |
with gr.Column():
|
| 125 |
+
webcam_input = gr.Video(source="webcam", height=256)
|
| 126 |
|
| 127 |
with gr.Row():
|
| 128 |
submit_detect_web = gr.Button("Detect and track objects", variant="primary")
|
|
|
|
| 142 |
|
| 143 |
|
| 144 |
# From file
|
| 145 |
+
submit_detect_file.click(fn=track_blocks,
|
| 146 |
inputs= video_input,
|
| 147 |
outputs = video_output4,
|
| 148 |
+
queue=True,
|
| 149 |
+
batch=True,
|
| 150 |
+
max_batch_size=16,)
|
| 151 |
|
| 152 |
|
| 153 |
submit_detect_web.click(fn=show_tracking,
|