File size: 410 Bytes
6105652
 
 
3218885
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="google/pegasus-xsum")

def predict(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=predict, inputs=textbox, outputs='text')

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