janduplessis886 commited on
Commit
596456f
·
verified ·
1 Parent(s): 9ad0ec5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ get_completion = pipeline("summarization", model="shleifer/distilbart-cnn-12-6")
5
+
6
+
7
+ def summarize(input):
8
+ output = get_completion(input)
9
+ return output[0]['summary_text']
10
+
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
+ demo.launch(share=True)