Spaces:
Runtime error
Runtime error
File size: 957 Bytes
69426ba a5e1c12 69426ba a5e1c12 69426ba a5e1c12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import gradio as gr
import os
from PIL import Image
import imageio
# ์ ์ฅ ๊ฒฝ๋ก
UPLOAD_DIR = "uploads"
os.makedirs(UPLOAD_DIR, exist_ok=True)
def save_images(image1, image2):
path1 = os.path.join(UPLOAD_DIR, "cut1.png")
path2 = os.path.join(UPLOAD_DIR, "cut2.png")
image1.save(path1)
image2.save(path2)
# ์ฌ๊ธฐ์๋ ์์๋ก ๋ ์ด๋ฏธ์ง ๊ทธ๋๋ก ์ด์ด๋ถ์ธ gif๋ฅผ ๋ฆฌํด
gif_path = os.path.join(UPLOAD_DIR, "output.gif")
imageio.mimsave(gif_path, [image1, image2], fps=1)
return gif_path
iface = gr.Interface(
fn=save_images,
inputs=[
gr.Image(label="์ปท1 ์
๋ก๋", type="pil"),
gr.Image(label="์ปท2 ์
๋ก๋", type="pil")
],
outputs=gr.Video(label="๊ฒฐ๊ณผ ์ ๋๋ฉ์ด์
"),
title="๐ ์ปท ๊ธฐ๋ฐ ์ ๋๋ฉ์ด์
์์ฑ๊ธฐ (์์)",
description="๋ ์ฅ์ ์ปท์ ์
๋ก๋ํ๋ฉด, ์ ๋๋ฉ์ด์
์ผ๋ก ์ด์ด์ฃผ๋ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ฌ์ค๋๋ค."
)
iface.launch()
|