File size: 700 Bytes
04147f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from transformers import pipeline

# Load the BART model for summarization
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")

# Function to summarize the input text
def summarize_text(text):
    summary = summarizer(text, min_length=10, max_length=100)
    return summary[0]['summary_text']

# Create the Gradio interface
iface = gr.Interface(
    fn=summarize_text, 
    inputs=gr.Textbox(label="Enter long text here", lines=10, placeholder="Enter a long text to summarize..."),
    outputs=gr.Textbox(label="Summarized text"),
    live=False,
    description="Text summarization application using the BART model"
)

# Launch the application
iface.launch()