Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Load summarizer pipeline (T5 model, lightweight) | |
| summarizer = pipeline("summarization", model="t5-small") | |
| def summarize_text(text): | |
| summary = summarizer(text, max_length=60, min_length=10, do_sample=False) | |
| return summary[0]['summary_text'] | |
| # Gradio interface | |
| iface = gr.Interface( | |
| fn=summarize_text, | |
| inputs=gr.Textbox( | |
| lines=8, | |
| placeholder="Paste any article or text here...", | |
| label="Input Text" | |
| ), | |
| outputs=gr.Textbox( | |
| lines=5, # Bigger visible box | |
| placeholder="Summary will appear here...", | |
| label="Summary", | |
| interactive=False # Makes it read-only | |
| ), | |
| title="AI Text Summarizer 📝✨", | |
| description="Summarize long text into short, clear insights quickly." | |
| ) | |
| iface.launch() |