import gradio as gr from diffusers.utils import load_image import os import cv2 import numpy as np from PIL import Image from moviepy.editor import * def get_canny_filter(image): image = load_image(image) image = np.array(image) low_threshold = 100 high_threshold = 200 image = cv2.Canny(image, low_threshold, high_threshold) image = image[:, :, None] image = np.concatenate([image, image, image], axis=2) image = Image.fromarray(image) return image def infer(imported_gif): clip = VideoFileClip(imported_gif.name) clip.write_videofile("my_gif_video.mp4") return "my_gif_video.mp4" inputs = [gr.File(label="import a GIF instead", file_types=['.gif'])] outputs = [gr.Video()] gr.Interface(fn=infer, inputs=inputs, outputs=outputs).launch()