File size: 650 Bytes
d76fd34
 
 
ae5f145
d76fd34
 
 
 
3173be4
d76fd34
81592a1
 
 
 
 
 
d76fd34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from transformers import pipeline

get_completion = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")

def summarize(input):
    output = get_completion(input)
    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 distilbart-cnn",
                    description="Summarize any text using the `sshleifer/distilbart-cnn-12-6` model under the hood"
                   )
demo.launch()