File size: 610 Bytes
414fbb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
!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()