File size: 607 Bytes
a3620d1
 
 
e759d30
a3620d1
 
 
 
 
e765d84
a3620d1
 
6612bbe
 
e03845d
 
 
4c19626
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Use a pipeline as a high-level helper
from transformers import pipeline
import gradio as gr
import os

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

def summarize(input):
    output = pipe(input)
    return output[0]['summary_text']
    
gr.close_all()
demo = gr.Interface(fn=summarize, 
                    inputs=[gr.Textbox(label="Text to summarize", lines=10)], 
                    outputs=[gr.Textbox(label="Text to summarize", lines=5)],
                    title="Text Summarization", 
                    description="Summarize any text using distilbart")
demo.launch()