Spaces:
Paused
Paused
import gradio as gr | |
from transformers import pipeline | |
import spaces | |
generator = pipeline('text-generation', model='distilgpt2', device=-1) | |
def generate_text(prompt, max_length): | |
result = generator(prompt, max_length=max_length, num_return_sequences=1) | |
return result[0]['generated_text'] | |
iface = gr.Interface( | |
fn=generate_text, | |
inputs=[ | |
gr.Textbox(label="γγγ³γγ"), | |
gr.Slider(minimum=10, maximum=100, step=1, label="ζ倧ι·") | |
], | |
outputs=gr.Textbox(label="ηζγγγγγγΉγ") | |
) | |
iface.launch() |