|
|
|
|
|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
generator = pipeline('text-to-image', model='CompVis/stable-diffusion-v1-4') |
|
|
|
def generate_image(prompt): |
|
|
|
images = generator(prompt, num_return_sequences=1) |
|
return images[0]['generated_image'] |
|
|
|
|
|
iface = gr.Interface( |
|
fn=generate_image, |
|
inputs=gr.inputs.Textbox(lines=2, placeholder="ํ
์คํธ๋ฅผ ์
๋ ฅํ์ธ์..."), |
|
outputs="image", |
|
title="ํ
์คํธ์์ ์ด๋ฏธ์ง ์์ฑ", |
|
description="ํ
์คํธ๋ฅผ ์
๋ ฅํ๋ฉด ํด๋น ํ
์คํธ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์ด๋ฏธ์ง๋ฅผ ์์ฑํฉ๋๋ค." |
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
iface.launch() |