File size: 673 Bytes
86c8e57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29c63f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)