yes2code's picture
Update app.py
731f753
raw
history blame
1.1 kB
import gradio as gr
#def greet(name):
# return "Hello " + name + "!!"
from transformers import pipeline
get_completion = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
def summarize(input, max_length='5'):
output = get_completion(input)
return output[0]['summary_text']
gr.close_all()
demo = gr.Interface(fn=summarize,
inputs=[gr.Textbox(label="Text to summarize", lines=6)],
outputs=[gr.Textbox(label="Summary result", lines=3)],
title="Text summarization with distilbart-cnn",
#title="Text summarization of large data",
#description="Summarize any text using the `shleifer/distilbart-cnn-12-6` model under the hood!"
description="GV user interface to summarize large text. Summarization produces a shorter version of the document (for example a research paper) while preserving the relevant and important information of the document."
)
#demo.launch(share=True, server_port=int(os.environ['PORT2']))
demo.launch(share=True)