Summarization / app.py
abdulsamad's picture
Update app.py
21b57f6 verified
raw
history blame
533 Bytes
from transformers import pipeline
import torch
import gradio as gr
summarizer = pipeline(task="summarization",
model="facebook/bart-large-cnn",
torch_dtype=torch.bfloat16)
# name of the function
def summary(text):
summary = summarizer(text,min_length=10,max_length=100)
return summary
# We instantiate the Textbox class
textbox = gr.Textbox(label="Summarizer: ", placeholder="Enter the text")
demo = gr.Interface(fn=summary, inputs=textbox, outputs="text")
demo.launch()