PJ2005's picture
Update app.py
8c0ca13 verified
raw
history blame contribute delete
689 Bytes
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=150, min_length=30, 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..."),
outputs=gr.Textbox(lines=8), # show full text without scrolling
title="AI Text Summarizer 📖✨",
description="Paste long text and get concise, clear summaries instantly!"
)
if __name__ == "__main__":
iface.launch()