Dannyar608's picture
Create Code
414fbb0 verified
!pip install transformers
!pip install gradio
import gradio as gr
from transformers import pipeline
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
def summarize_text(text):
summary = summarizer(text, max_length=200, min_length=100, do_sample=False)
return summary[0]['summary_text']
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."
)
demo.launch()