Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
pipe = pipeline("summarization", model="facebook/bart-large-cnn") | |
def summarize_text(text): | |
summary = pipe(text, max_length=150, min_length=40, do_sample=False) | |
return summary[0]['summary_text'] | |
title = "Text Summarization with BART" | |
description = "Provide a block of text, and the BART model will summarize it." | |
interface = gr.Interface( | |
fn=summarize_text, | |
inputs=gr.Textbox(lines=10, label="Input Text"), | |
outputs=gr.Textbox(label="Summarized Text"), | |
title=title, | |
description=description, | |
) | |
if __name__ == "__main__": | |
interface.launch() | |