|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
pipe = pipeline("summarization", model="yashugupta786/bart_large_xsum_samsum_conv_summarizer") |
|
|
|
|
|
def summarize(text): |
|
summary = pipe(text) |
|
return summary[0]['summary_text'] |
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.Interface( |
|
fn=summarize, |
|
inputs=gr.Textbox(label="Input Text", placeholder="Enter text to summarize..."), |
|
outputs=gr.Textbox(label="Summary"), |
|
title="Text Summarization", |
|
description="Summarize the input text using BART model." |
|
).launch(share=True) |
|
|