import gradio as gr from transformers import pipeline task = 'summarization' model = 'sshleifer/distilbart-cnn-12-6' get_completion = pipeline(task=task, model=model) def summarize(input): output = get_completion(input) return output[0]['summary_text'] result = gr.Interface(fn=summarize, inputs=[gr.TextArea(label='Text to summerize:')], outputs=gr.TextArea(label='Summary'), title='Text summerization with distilbart-cnn', description="Summerize any text using `sshleifer/distilbart-cnn-12-6` model under the hood!" ) result.launch(inline=False, share=True)