Sum4rize / app.py
tomato
fix coding error
4db7dc4
raw
history blame
976 Bytes
import gradio as gr
import torch
from tqdm import tqdm
from transformers import pipeline
MODEL_NAME = "csebuetnlp/mT5_multilingual_XLSum"
summarizer = pipeline(task="summarization", model=MODEL_NAME)
def summarize(text):
return summarizer(text)
demo = gr.Blocks(title="⭐ Summ4rizer ⭐")
demo.encrypt = False
with demo:
gr.Markdown(f'''
<div>
<h1 style='text-align: center'>Text Summarizer</h1>
</div>
<div>
Using summarization Model from <a href='https://huggingface.co/{MODEL_NAME}' target='_blank'><b>{MODEL_NAME}</b></a>.
</div>
''')
text = gr.Textbox(label="Text here !!", lines=1, interactive=True)
summarize_btn = gr.Button("Let's Summarize",)
summarization = gr.Textbox()
html_output = gr.Markdown()
summarize_btn.click(summarize, [text], outputs=[html_output, summarization])
demo.launch()