Spaces:
Sleeping
Sleeping
from transformers import pipeline | |
import gradio as gr | |
# Load the summarizer model | |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
# Define the function for Gradio to use | |
def summarize_article(text): | |
summary = summarizer(text, max_length=130, min_length=30, do_sample=False) | |
return summary[0]['summary_text'] | |
# Gradio interface | |
iface = gr.Interface( | |
fn=summarize_article, | |
inputs=gr.Textbox(lines=20, label="Enter News Article π"), | |
outputs=gr.Textbox(label="Summary β¨"), | |
title="Article Summarizer π°", | |
description="Paste your article and get a short summary! Powered by facebook/bart-large-cnn." | |
) | |
# Launch the app | |
iface.launch() | |