File size: 428 Bytes
6105652
 
 
19bab30
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="airKlizz/mt5-base-wikinewssum-italian")

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()