Spaces:
Runtime error
Runtime error
Update app.py
Browse files26 unmodified lines272829303132270 unmodified lines30330430530630730830931031131226 unmodified linesfrom PIL import Image, ImageFilterfrom sam2.build_sam import build_sam2_video_predictordef preprocess_image(image):return image, gr.State([]), gr.State([]), image, gr.State()270 unmodified lines# Close the plotplt.close()if vis_frame_type == "check":return gr.update(value=jpeg_images, visible=True), gr.update(visible=False, value=None)elif vis_frame_type == "render":return gr.update(visible=False, value=None), gr.update(value=final_vid, visible=True)with gr.Blocks() as demo:26 unmodified lines2728293031323334270 unmodified lines30530630730830931031131231331431531631731831932032132226 unmodified linesfrom PIL import Image, ImageFilterfrom sam2.build_sam import build_sam2_video_predictorfrom moviepy.editor import ImageSequenceClipdef preprocess_image(image):return image, gr.State([]), gr.State([]), image, gr.State()270 unmodified lines# Close the plotplt.close()if vis_frame_type == "check":return gr.update(value=jpeg_images, visible=True), gr.update(visible=False, value=None)elif vis_frame_type == "render":# Create a video clip from the image sequencefps = 24 # Frames per secondclip = ImageSequenceClip(jpeg_images, fps=fps)# Write the result to a filefinal_vid_output_path = "output_video.mp4"video.write_videofile(output_path, codec='libx264')return gr.update(visible=False, value=None), gr.update(value=final_vid_output_path, visible=True)with gr.Blocks() as demo:
app.py+11-1