Spaces:
Running
on
A100
Running
on
A100
initial test
Browse files
app.py
CHANGED
@@ -118,45 +118,58 @@ def create_ui(examples_path: str):
|
|
118 |
)
|
119 |
process_btn = gr.Button("Process Video", variant="primary")
|
120 |
|
121 |
-
|
122 |
|
123 |
-
with gr.Row(
|
124 |
with gr.Column():
|
125 |
-
video_description = gr.Markdown(
|
126 |
with gr.Column():
|
127 |
-
highlight_types = gr.Markdown(
|
128 |
|
129 |
-
with gr.Row(
|
130 |
-
output_video = gr.Video(label="Highlight Video")
|
131 |
-
download_btn = gr.Button("Download Highlights")
|
132 |
-
|
133 |
-
error_msg = gr.Markdown(visible=False)
|
134 |
|
135 |
def on_process(video):
|
136 |
if not video:
|
137 |
-
return
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
141 |
|
|
|
142 |
output_path, desc, highlights, err = process_video(video)
|
143 |
|
144 |
if err:
|
145 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
process_btn.click(
|
150 |
on_process,
|
151 |
inputs=[input_video],
|
152 |
-
outputs=[
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
]
|
160 |
)
|
161 |
|
162 |
return app
|
|
|
118 |
)
|
119 |
process_btn = gr.Button("Process Video", variant="primary")
|
120 |
|
121 |
+
status = gr.Markdown(visible=True)
|
122 |
|
123 |
+
with gr.Row() as results_row:
|
124 |
with gr.Column():
|
125 |
+
video_description = gr.Markdown(visible=False)
|
126 |
with gr.Column():
|
127 |
+
highlight_types = gr.Markdown(visible=False)
|
128 |
|
129 |
+
with gr.Row() as output_row:
|
130 |
+
output_video = gr.Video(label="Highlight Video", visible=False)
|
131 |
+
download_btn = gr.Button("Download Highlights", visible=False)
|
|
|
|
|
132 |
|
133 |
def on_process(video):
|
134 |
if not video:
|
135 |
+
return {
|
136 |
+
status: "Please upload a video",
|
137 |
+
video_description: gr.update(visible=False),
|
138 |
+
highlight_types: gr.update(visible=False),
|
139 |
+
output_video: gr.update(visible=False),
|
140 |
+
download_btn: gr.update(visible=False)
|
141 |
+
}
|
142 |
|
143 |
+
status.value = "Processing video..."
|
144 |
output_path, desc, highlights, err = process_video(video)
|
145 |
|
146 |
if err:
|
147 |
+
return {
|
148 |
+
status: f"Error: {err}",
|
149 |
+
video_description: gr.update(visible=False),
|
150 |
+
highlight_types: gr.update(visible=False),
|
151 |
+
output_video: gr.update(visible=False),
|
152 |
+
download_btn: gr.update(visible=False)
|
153 |
+
}
|
154 |
|
155 |
+
return {
|
156 |
+
status: "Processing complete!",
|
157 |
+
video_description: gr.update(value=desc, visible=True),
|
158 |
+
highlight_types: gr.update(value=highlights, visible=True),
|
159 |
+
output_video: gr.update(value=output_path, visible=True),
|
160 |
+
download_btn: gr.update(visible=True)
|
161 |
+
}
|
162 |
|
163 |
process_btn.click(
|
164 |
on_process,
|
165 |
inputs=[input_video],
|
166 |
+
outputs=[status, video_description, highlight_types, output_video, download_btn]
|
167 |
+
)
|
168 |
+
|
169 |
+
download_btn.click(
|
170 |
+
lambda x: x,
|
171 |
+
inputs=[output_video],
|
172 |
+
outputs=[output_video]
|
|
|
173 |
)
|
174 |
|
175 |
return app
|