Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Load the summarization pipeline | |
| summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") | |
| def summarize_text(text): | |
| summary = summarizer(text, max_length=130, min_length=30, do_sample=False) | |
| return summary[0]['summary_text'] | |
| # Create Gradio Interface | |
| demo = gr.Interface(fn=summarize_text, | |
| inputs=gr.Textbox(lines=10, placeholder="Enter article text here..."), | |
| outputs="text", | |
| title="Text Summarization", | |
| description="Enter any long text and get a concise summary using DistilBART.") | |
| if __name__ == "__main__": | |
| demo.launch() |