File size: 421 Bytes
be95b82
 
 
 
 
 
 
 
 
 
 
c05bda0
be95b82
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from transformers import pipeline
import gradio as gr

summarizer = pipeline("summarization", model = "facebook/bart-large-cnn")

def get_summary(input):
    output = summarizer(input)
    return output[0]["summary_text"]

demo = gr.Blocks()
with demo:
    textbox = gr.Textbox(placeholder="Enter text to summarize...", lines=4)
    btn = gr.Button("Summarize")
    btn.click(get_summary, textbox, textbox)

demo.launch()