File size: 418 Bytes
6105652
 
 
4738e5b
6105652
d459b8e
6105652
 
 
 
 
d459b8e
6105652
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from transformers import pipeline
import gradio as gr

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

def summarize(text):
    summary = model(text)[0]['summary_text']
    return summary

with gr.Blocks() as ui:
    textbox = gr.Textbox(placeholder='Enter text to summarize', label='input')
    gr.Interface(fn=summarize, inputs=textbox, outputs='text')

if __name__ == '__main__':
    ui.launch()