Update app.py
Browse files79 unmodified lines80818283848586838485868788918990919217 unmodified lines11011111211511611711811912012112211311411536 unmodified lines1521531541651551561571587 unmodified lines16616716817916917017117279 unmodified lines if not os.path.exists(output_dir): os.makedirs(output_dir)
processed_video_path = os.path.join(output_dir, os.path.splitext(video_name)[0]+'_src.mp4') depth_vis_path = os.path.join(output_dir, os.path.splitext(video_name)[0]+'_vis.mp4') save_video(frames, processed_video_path, fps=fps) save_video(depths, depth_vis_path, fps=fps, is_depths=True, grayscale=grayscale) processed_video_path = os.path.join(output_dir, os.path.splitext(video_name)[0]+'.mp4') save_video(frames, depths, processed_video_path, fps=fps, grayscale=grayscale)
gc.collect() torch.cuda.empty_cache()
return [processed_video_path, depth_vis_path] return processed_video_path
def construct_demo():17 unmodified lines show_share_button=True, scale=5, ) depth_vis_video = gr.Video( label="Generated Depth Video", interactive=False, autoplay=True, loop=True, show_share_button=True, scale=5, )
with gr.Row(equal_height=True): with gr.Column(scale=1):36 unmodified lines target_fps, max_res ], outputs=[processed_video, depth_vis_video], outputs=[processed_video], fn=infer_video_depth, cache_examples="lazy", )7 unmodified lines max_res, grayscale ], outputs=[processed_video, depth_vis_video], outputs=[processed_video], )
return demoapp.py+5-15