import gradio as gr from transformers import pipeline generator = pipeline('text-generation', model='gpt2') def generate(text): classifier = pipeline("sentiment-analysis") result = classifier(text) return result examples = [ ["SE is the best company in the world!"], ["GE is the worst company in the world!"], ] demo = gr.Interface( fn=generate, inputs=gr.inputs.Textbox(lines=5, label="Input Text"), outputs=gr.outputs.Textbox(label="Generated Text"), examples=examples ) demo.launch()