File size: 577 Bytes
2d71bf6
a46b0f6
0669fa1
a46b0f6
 
30fd9a1
a46b0f6
 
 
0669fa1
a46b0f6
0669fa1
a46b0f6
 
 
0669fa1
 
a46b0f6
b30eb63
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

# 모델을 pipeline으로 초기화합니다.
text_gen = pipeline("text-generation", model="stabilityai/sdxl-turbo")

def generate_text(prompt):
    # 생성된 텍스트를 리턴합니다.
    return text_gen(prompt, max_length=50, do_sample=True)[0]['generated_text']

# Gradio 인터페이스를 생성합니다.
iface = gr.Interface(
    fn=generate_text,
    inputs=gr.Textbox(lines=2, placeholder="Enter a prompt to generate text"),
    outputs=gr.Textbox(),
)

# 인터페이스를 실행합니다.
iface.launch()