Spaces:
Running
Running
File size: 735 Bytes
0669fa1 30fd9a1 0669fa1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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()
|