Spaces:
Sleeping
Sleeping
| 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() |