Amruthaa commited on
Commit
be95b82
·
1 Parent(s): 0947eb7

Adding text summarizer

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ summarizer = pipeline("summarization", model = "facebook/bart-large-cnn")
5
+
6
+ def get_summary(input):
7
+ output = summarizer(input)
8
+ return output[0]["summary_text"]
9
+
10
+ demo = gr.Blocks()
11
+ with demo:
12
+ textbox = gr.TextBox(placeholder="Enter text to summarize...", lines=4)
13
+ btn = gr.Button("Summarize")
14
+ btn.click(get_summary, textbox, textbox)
15
+
16
+ demo.launch()