File size: 700 Bytes
e0d2a7f
 
 
 
 
 
 
 
 
 
 
 
 
 
2492612
2efe0df
e0d2a7f
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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="Summarize any text that is 1,000 words or less!  If you hit an error, your text is probably too long."
                   )

demo.launch()