Spaces:
Sleeping
Sleeping
File size: 593 Bytes
164895a 7d795f4 164895a 7d795f4 164895a 7d795f4 164895a 7d795f4 164895a 7d795f4 164895a 7d795f4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import gradio as gr
from transformers import pipeline
# Load a text summarization pipeline
summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
def summarize(text):
summary = summarizer(text, max_length=100, min_length=25, do_sample=False)
return summary[0]['summary_text']
demo = gr.Interface(
fn=summarize,
inputs=gr.Textbox(lines=6, placeholder="Paste an article or paragraph here..."),
outputs="text",
title="Simple Text Summarizer",
description="Summarize long articles using DistilBART (Hugging Face Transformers)"
)
demo.launch() |