File size: 413 Bytes
79655d7 1919867 6f70237 79655d7 a6e3d1d e1ebc0a 1919867 a6e3d1d 1919867 a6e3d1d e01ba12 883df2c a02f7e6 a6e3d1d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import gradio as gr
from transformers import pipeline
import torch
summariser = pipeline(task="summarization", model="t5-base", tokenizer="t5-base")
def get_summary(text):
summary = summariser(text, min_length=5, max_length=100)
return summary[0]["summary_text"]
iface = gr.Interface(fn=get_summary,
inputs="text",
outputs=['text'])
iface.launch(share=False)
|