File size: 617 Bytes
2ba0207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from transformers import pipeline
import gradio as gr

def summarize(content,size):
  bot=pipeline('summarization',model='Falconsai/text_summarization')
  text=content
  if size=='' :
    size='50'
  
  result=bot(text,min_length=int(size))

  return result[0]['summary_text']

with gr.Blocks(theme=gr.themes.Soft()) as window:
  gr.Markdown('5th gen text summarizer')
  inp=gr.Textbox(label=' ',placeholder='Enter the text you want ot summarize')
  length=gr.Textbox(label='Length')
  btn=gr.Button('Summarize')
  out=gr.TextArea(label=' ')
  btn.click(fn=summarize,inputs=[inp,length],outputs=out)


window.launch()