Spaces:
Running
on
A100
Running
on
A100
initial test
Browse files
app.py
CHANGED
@@ -116,7 +116,10 @@ def create_ui(examples_path: str):
|
|
116 |
label="Upload your video (max 20 minutes)",
|
117 |
interactive=True
|
118 |
)
|
|
|
119 |
|
|
|
|
|
120 |
with gr.Row(visible=False) as results_row:
|
121 |
with gr.Column():
|
122 |
video_description = gr.Markdown(label="Video Analysis")
|
@@ -129,37 +132,31 @@ def create_ui(examples_path: str):
|
|
129 |
|
130 |
error_msg = gr.Markdown(visible=False)
|
131 |
|
132 |
-
def
|
133 |
-
results_row.visible = False
|
134 |
-
output_row.visible = False
|
135 |
-
error_msg.visible = False
|
136 |
-
|
137 |
if not video:
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
141 |
|
142 |
output_path, desc, highlights, err = process_video(video)
|
143 |
|
144 |
if err:
|
145 |
-
|
146 |
-
error_msg.value = err
|
147 |
-
return None, None, None, error_msg
|
148 |
|
149 |
-
|
150 |
-
output_row.visible = True
|
151 |
-
return output_path, desc, highlights, ""
|
152 |
|
153 |
-
|
154 |
-
|
155 |
inputs=[input_video],
|
156 |
-
outputs=[
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
163 |
)
|
164 |
|
165 |
return app
|
|
|
116 |
label="Upload your video (max 20 minutes)",
|
117 |
interactive=True
|
118 |
)
|
119 |
+
process_btn = gr.Button("Process Video", variant="primary")
|
120 |
|
121 |
+
processing_msg = gr.Markdown(visible=False)
|
122 |
+
|
123 |
with gr.Row(visible=False) as results_row:
|
124 |
with gr.Column():
|
125 |
video_description = gr.Markdown(label="Video Analysis")
|
|
|
132 |
|
133 |
error_msg = gr.Markdown(visible=False)
|
134 |
|
135 |
+
def on_process(video):
|
|
|
|
|
|
|
|
|
136 |
if not video:
|
137 |
+
return None, None, None, "Please upload a video", False, False
|
138 |
+
|
139 |
+
processing_msg.visible = True
|
140 |
+
processing_msg.value = "Starting video processing..."
|
141 |
|
142 |
output_path, desc, highlights, err = process_video(video)
|
143 |
|
144 |
if err:
|
145 |
+
return None, None, None, err, False, False
|
|
|
|
|
146 |
|
147 |
+
return output_path, desc, highlights, "", True, True
|
|
|
|
|
148 |
|
149 |
+
process_btn.click(
|
150 |
+
on_process,
|
151 |
inputs=[input_video],
|
152 |
+
outputs=[
|
153 |
+
output_video,
|
154 |
+
video_description,
|
155 |
+
highlight_types,
|
156 |
+
error_msg,
|
157 |
+
results_row,
|
158 |
+
output_row
|
159 |
+
]
|
160 |
)
|
161 |
|
162 |
return app
|