import gradio as gr import torch from tqdm import tqdm from transformers import pipeline MODEL_NAME = "IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chinese" 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'''

Text Summarizer

Using summarization Model from {MODEL_NAME}.
''') 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()