import os import cv2 import numpy as np import gradio as gr import PIL from PIL import Image def exec_cmd(image): # image_data=np.asarray(image) # cv2.imwrite(r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\images\me.jpg",image) image.save(r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\images\me.jpg") os.system("python create_gif.py --config config.json --image images/me.jpg --output me.gif") # output=cv2.imread(r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\me.gif") # output=Image.open(r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\me.gif") output=r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\me.gif" return output interface = gr.Interface(fn=exec_cmd, inputs=gr.inputs.Image(type="pil"),outputs=gr.outputs.Image(type="file")) interface.launch(share=True)