Spaces:
Running
Running
from transformers import pipeline | |
# ๋ณ๊ฒฝ๋ ์ฝ๋: Stable Diffusion ๋ชจ๋ธ ์ฌ์ฉ | |
model = pipeline('text-to-image', model='CompVis/stable-diffusion-v1-4') | |
# ์ด๋ฏธ์ง ์์ฑ ์์ | |
generated_images = model("A cute puppy sitting on the moon") | |
def generate_image(prompt): | |
response = model(prompt, return_tensors="pt") | |
return response.images[0] | |
# Gradio ์ธํฐํ์ด์ค ์์ฑ | |
iface = gr.Interface( | |
fn=generate_image, | |
inputs=gr.inputs.Textbox(lines=2, placeholder="์ฌ๊ธฐ์ ํ ์คํธ๋ฅผ ์ ๋ ฅํ์ธ์..."), | |
outputs=gr.outputs.Image(type="pil"), | |
title="ํ ์คํธ๋ฅผ ์ด๋ฏธ์ง๋ก ๋ณํ", | |
description="ํ ์คํธ๋ฅผ ์ ๋ ฅํ๋ฉด ์ด๋ฏธ์ง๋ฅผ ์์ฑํฉ๋๋ค." | |
) | |
# ์ธํฐํ์ด์ค ์คํ | |
iface.launch() | |