ashutoshzade commited on
Commit
1fd4f13
1 Parent(s): bc0e2ca

Initial version

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ get_completion = pipeline("summarization", model="shleifer/distilbart-cnn-12-6")
5
+
6
+ def summarize(input):
7
+ output = get_completion(input)
8
+ return output[0]['summary_text']
9
+
10
+ gr.close_all()
11
+ demo = gr.Interface(fn=summarize,
12
+ inputs=[gr.Textbox(label="Text to summarize", lines=6)],
13
+ outputs=[gr.Textbox(label="Result", lines=3)],
14
+ title="Text summarization with distilbart-cnn",
15
+ description="Summarize any text using the `shleifer/distilbart-cnn-12-6` model under the hood!"
16
+ )
17
+
18
+ demo.launch()
19
+