Spaces:
Sleeping
Sleeping
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() |