Update app.py
Browse files79 unmodified lines80818283848586878889909192939417 unmodified lines11211311411511611711811912012112212312412536 unmodified lines1621631641651661671687 unmodified lines17617717817918018118279 unmodified linesif 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)gc.collect()torch.cuda.empty_cache()return [processed_video_path, depth_vis_path]def construct_demo():17 unmodified linesshow_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 linestarget_fps,max_res],outputs=[processed_video, depth_vis_video],fn=infer_video_depth,cache_examples="lazy",)7 unmodified linesmax_res,grayscale],outputs=[processed_video, depth_vis_video],)return demo79 unmodified lines8081828384858687888990919217 unmodified lines11011111211311411536 unmodified lines1521531541551561571587 unmodified lines16616716816917017117279 unmodified linesif not os.path.exists(output_dir):os.makedirs(output_dir)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_pathdef construct_demo():17 unmodified linesshow_share_button=True,scale=5,)with gr.Row(equal_height=True):with gr.Column(scale=1):36 unmodified linestarget_fps,max_res],outputs=[processed_video],fn=infer_video_depth,cache_examples="lazy",)7 unmodified linesmax_res,grayscale],outputs=[processed_video],)return demo
app.py+5-15