|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
summarizer = pipeline("summarization", model="facebook/bart-large-cnn") |
|
|
|
|
|
def summarize_text(text): |
|
summary = summarizer(text, min_length=10, max_length=100) |
|
return summary[0]['summary_text'] |
|
|
|
|
|
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" |
|
) |
|
|
|
|
|
iface.launch() |
|
|