Spaces:
Sleeping
Sleeping
File size: 691 Bytes
384582b 8ee72fb ccbb8fd 384582b 8ee72fb ccbb8fd 384582b 8ee72fb 384582b ccbb8fd 384582b 8ee72fb ad7cdfc 8ee72fb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
from transformers import pipeline
# Initialize the summarizer pipeline
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
# Define the summarization function
def summarize_text(text):
summary = summarizer(text, max_length=200, min_length=100, do_sample=False)
return summary[0]['summary_text']
# Create the Gradio interface
demo = gr.Interface(
fn=summarize_text,
inputs=gr.Textbox(placeholder="Enter your text here", label="Input Text"),
outputs=gr.Textbox(label="Summary"),
title="Text Summarizer",
description="This chatbot takes a long text as input and returns a summary."
)
# Launch the interface
demo.launch()
|