File size: 1,029 Bytes
008c811
 
 
e7e12d3
 
 
008c811
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
gr.close_all()

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 `shleifer/distilbart-cnn-12-6` model under the hood!"
                    inputs=[gr.Textbox(label="What do you want summarize !", lines=6)],
                    outputs=[gr.Textbox(label="Magic Summarization !!!", lines=3)],
                    title="Text summarization test and demo app by Srinivas.V ..",
                    description="Summarize any text",
                    allow_flagging="never"
                   )
demo.launch(share=True)