File size: 644 Bytes
90951f0
 
 
 
 
 
 
c225b26
 
90951f0
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()