from transformers import pipeline import gradio as gr summarizer = pipeline("summarization", model="Afsara/fb_bart_large_cnn") def summarize(input): output = summarizer(input, max_length=130, min_length=30, do_sample=False) return output[0]['summary_text'] gr.close_all() demo = gr.Interface(fn=summarize, inputs=[gr.Textbox(label="Text to summarize", lines=6)], outputs=[gr.Textbox(label="Result", lines=3)], title="Text summarization with bart-cnn", description="Bob gets to the bottom line, every time! Summarize any text that is 1,000 words or less. If you hit an error, your text is probably too long." ) demo.launch()