File size: 350 Bytes
c849353
0a8dafe
b224adf
0a8dafe
 
bd1a784
c849353
988217c
bd1a784
0a8dafe
c849353
988217c
c849353
1
2
3
4
5
6
7
8
9
10
11
12
13
import gradio as gr
import transformers
import torch
from transformers import pipeline

summarizer = pipeline("summarization", model="google-t5/t5-base", tokenizer="google-t5/t5-base", framework="pt")

def summarize(text):
    return summarizer(text, max_length=20)
    

demo = gr.Interface(fn=summarize, inputs="text", outputs="text")
demo.launch()