File size: 563 Bytes
3dc74fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from transformers import pipeline
import gradio as gr

def textSummarizer(ARTICLE,OutputLength):
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
  result = summarizer(ARTICLE, max_length=244, min_length=OutputLength, do_sample=False)
  return result[0]["summary_text"]


app = gr.Interface(textSummarizer,
                   inputs = [gr.Textbox(),gr.Slider(minimum=0,maximum=50,step=1)],
                   outputs = gr.Textbox(),
                   title = "Article Summarizer",
                   theme=gr.themes.Soft())

app.launch()