Text-summarizer / app.py
harjinderisher's picture
Create app.py
b9ac3b1 verified
import torch
import gradio
from transformers import pipeline
text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-3",
torch_dtype=torch.bfloat16)
# text="Leati Joseph Anoaʻi (Samoan pronunciation: [a.noˈaʔ.i] ah-no-AH ee; born May 25, 1985), better known by his ring name Roman Reigns, is an American professional wrestler and former football player and actor. As a wrestler, he has been signed to WWE since 2010, where he performs on the Raw brand. Regarded as one of the best professional wrestlers in the world,[9][10] Reigns' 1,316-day reign with the WWE Universal Championship is the fourth longest world title reign in WWE history and the longest championship reign recognised by the company since 1988.[a]"
# print(text_summary(text))
def summary(input):
output = text_summary(input)
return output[0]['summary_text']
gradio.close_all()
demo = gradio.Interface(fn=summary,inputs=[gradio.Textbox(label="INPUT TEXT TO SUMMARIZE TEXT",lines=6)]
,outputs=[gradio.Textbox(label="Summarized text")],
title="Text Summarizer",description="this application will be used to create Summarized Text")
demo.launch(share=True)