Spaces:
Runtime error
Runtime error
changing video input for file input
Browse files
app.py
CHANGED
|
@@ -174,7 +174,13 @@ def draw_cockpit(frame, top_pred,cnt):
|
|
| 174 |
|
| 175 |
def process_video(input_video, out_fps = 'auto', skip_frames = 7):
|
| 176 |
print('Processing video: ')
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
output_path = "output.mp4"
|
| 180 |
if out_fps != 'auto' and type(out_fps) == int:
|
|
@@ -261,13 +267,16 @@ def process_video(input_video, out_fps = 'auto', skip_frames = 7):
|
|
| 261 |
yield None, output_path
|
| 262 |
|
| 263 |
with gr.Blocks(theme=theme) as demo:
|
|
|
|
|
|
|
|
|
|
| 264 |
with gr.Row().style(equal_height=True,height='25%'):
|
| 265 |
-
|
| 266 |
original_frames = gr.Image(label="Processed Frame").style( height=650)
|
| 267 |
#processed_frames = gr.Image(label="Shark Engine")
|
| 268 |
-
output_video = gr.Video(label="Output Video")
|
| 269 |
-
#dashboard = gr.Image(label="Events")
|
| 270 |
|
|
|
|
|
|
|
| 271 |
with gr.Row():
|
| 272 |
paths = sorted(pathlib.Path('videos_example/').rglob('*.mp4'))
|
| 273 |
samples=[[path.as_posix()] for path in paths if 'raw_videos' in str(path)]
|
|
|
|
| 174 |
|
| 175 |
def process_video(input_video, out_fps = 'auto', skip_frames = 7):
|
| 176 |
print('Processing video: ')
|
| 177 |
+
|
| 178 |
+
try:
|
| 179 |
+
cap = cv2.VideoCapture(input_video.name)
|
| 180 |
+
except:
|
| 181 |
+
cap = cv2.VideoCapture(input_video)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
|
| 185 |
output_path = "output.mp4"
|
| 186 |
if out_fps != 'auto' and type(out_fps) == int:
|
|
|
|
| 267 |
yield None, output_path
|
| 268 |
|
| 269 |
with gr.Blocks(theme=theme) as demo:
|
| 270 |
+
input_video = gr.File(label="Input")
|
| 271 |
+
|
| 272 |
+
|
| 273 |
with gr.Row().style(equal_height=True,height='25%'):
|
| 274 |
+
|
| 275 |
original_frames = gr.Image(label="Processed Frame").style( height=650)
|
| 276 |
#processed_frames = gr.Image(label="Shark Engine")
|
|
|
|
|
|
|
| 277 |
|
| 278 |
+
#dashboard = gr.Image(label="Events")
|
| 279 |
+
output_video = gr.File(label="Output Video")
|
| 280 |
with gr.Row():
|
| 281 |
paths = sorted(pathlib.Path('videos_example/').rglob('*.mp4'))
|
| 282 |
samples=[[path.as_posix()] for path in paths if 'raw_videos' in str(path)]
|