text_generator / app.py
royyy's picture
Update app.py
f8c07ac
raw
history blame contribute delete
604 Bytes
import gradio as gr
from transformers import pipeline
generator = pipeline('text-generation', model='EleutherAI/gpt-neo-1.3B')
examples = [
["Once upon a time, Dr. Woo was teaching computer programming in a school."],
["Once upon a time, Dr. Woo was walking in a park. He "]
]
def generate(text):
result=generator(text, max_length=100, num_return_sequences=3)
return result[0]['generated_text']
gr.Interface(fn=generate, inputs=gr.inputs.Textbox(lines=5, label='input text'), outputs=gr.outputs.Textbox(label='output text'), title='My First Text Generator', examples=examples).launch()