Spaces:
Sleeping
Sleeping
File size: 685 Bytes
6957c19 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
from transformers import pipeline
# Load summarization pipeline
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
# Function to summarize text
def summarize_text(text):
summary = summarizer(text, max_length=130, min_length=30, do_sample=False)
return summary[0]['summary_text']
# Gradio interface
interface = gr.Interface(
fn=summarize_text,
inputs=gr.Textbox(lines=10, placeholder="Paste your long text here...", label="Input Text"),
outputs=gr.Textbox(label="Summary"),
title="📝 Text Summarizer",
description="Summarize long articles using a pre-trained BART model from Hugging Face."
)
interface.launch()
|