raul-padua commited on
Commit
81bc86d
1 Parent(s): 02da84f

Upload 2 files

Browse files

app.py with code and requirements.txt with dependencies.

Files changed (2) hide show
  1. app.py +16 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ demo = gr.Interface(fn=summarize,
11
+ inputs=[gr.Textbox(label="Text to summarize", lines=6)],
12
+ outputs=[gr.Textbox(label="Result", lines=3)],
13
+ title="Text summarization with distilbart-cnn",
14
+ description="Summarize any text using the `shleifer/distilbart-cnn-12-6` model under the hood!"
15
+ )
16
+ demo.launch(share=True)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ gradio