File size: 662 Bytes
692d676
 
 
 
 
e7ea3a0
 
 
 
 
b27912e
 
 
7f5a958
b27912e
7f5a958
b27912e
20e45cb
b27912e
e7ea3a0
b27912e
29a41b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr

from transformers import pipeline

get_completion = pipeline("summarization", model="Falconsai/text_summarization")

def summarize(input):
    output = get_completion(input)
    return output[0]['summary_text']

with gr.Blocks() as demo:
    with gr.Row():
        with gr.Column(min_width=900):
            inputs = gr.Textbox(label="Input: Fill in the English text to summarise", lines=6)
            btn = gr.Button("Submit") #Submit button
            outputs = gr.Textbox(label="Output: Summarisation result", lines=3)
            
    btn.click(fn=summarize, inputs=[inputs], outputs=[outputs])

gr.close_all()

demo.launch(share=True)