consum / app.py
karthi311's picture
Update app.py
40f6c1c verified
raw
history blame contribute delete
640 Bytes
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)