File size: 873 Bytes
0dcfd31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)