Spaces:
Sleeping
Sleeping
File size: 493 Bytes
92e47b0 aa05842 92e47b0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from transformers import pipeline, set_seed
import gradio as grad
gpt2_pipe = pipeline('text-generation', model = 'distilgpt2')
set_seed(42)
def generate(starting_text):
response = gpt2_pipe(starting_text, max_length = 20, num_return_sequences = 5)
return response
txt = grad.Textbox(lines = 1, label = 'English', placeholder = 'English Text Here')
out = grad.Textbox(lines = 1, label = 'Generated Text')
grad.Interface(
generate,
inputs = txt,
outputs = out
).launch() |