File size: 640 Bytes
3bd4498 40f6c1c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from transformers import pipeline
# Load the summarization pipeline
pipe = pipeline("summarization", model="yashugupta786/bart_large_xsum_samsum_conv_summarizer")
# Summarization function
def summarize(text):
summary = pipe(text)
return summary[0]['summary_text']
# Gradio interface
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)
|