Spaces:
Build error
Build error
| import gradio as gr | |
| from transformers import pipeline | |
| # Load summarization model | |
| summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
| def summarize_text(text): | |
| if not text.strip(): | |
| return "Please enter some text!" | |
| summary = summarizer(text, max_length=100, min_length=25, do_sample=False) | |
| return summary[0]['summary_text'] | |
| iface = gr.Interface( | |
| fn=summarize_text, | |
| inputs=gr.Textbox(lines=10, placeholder="Paste your text here..."), | |
| outputs="text", | |
| title="📝 Text Summarizer", | |
| description="Paste any text and get a short, easy-to-read summary instantly using AI!" | |
| ) | |
| iface.launch() |