Spaces:
Runtime error
Runtime error
tianliang@szlanyou.com
commited on
Commit
•
0dcfd31
1
Parent(s):
9413c19
add application file
Browse files- wear_birthday_crown.py +19 -0
wear_birthday_crown.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import cv2
|
3 |
+
import numpy as np
|
4 |
+
import gradio as gr
|
5 |
+
import PIL
|
6 |
+
from PIL import Image
|
7 |
+
|
8 |
+
def exec_cmd(image):
|
9 |
+
# image_data=np.asarray(image)
|
10 |
+
# cv2.imwrite(r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\images\me.jpg",image)
|
11 |
+
image.save(r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\images\me.jpg")
|
12 |
+
os.system("python create_gif.py --config config.json --image images/me.jpg --output me.gif")
|
13 |
+
# output=cv2.imread(r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\me.gif")
|
14 |
+
# output=Image.open(r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\me.gif")
|
15 |
+
output=r"D:\PythonProject\birthday_crown\Creating-GIFs-with-OpenCV-master\me.gif"
|
16 |
+
return output
|
17 |
+
|
18 |
+
interface = gr.Interface(fn=exec_cmd, inputs=gr.inputs.Image(type="pil"),outputs=gr.outputs.Image(type="file"))
|
19 |
+
interface.launch(share=True)
|