rexoscare commited on
Commit
cf433a2
1 Parent(s): 10df284

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +26 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!pip install -q torch transformers gradio
2
+
3
+ import os
4
+ import io
5
+ from IPython.display import Image, display, HTML
6
+ from PIL import Image
7
+ from transformers import pipeline
8
+
9
+ get_completion = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
10
+
11
+ def summarize(input):
12
+ output = get_completion(input)
13
+ return output[0]['summary_text']
14
+
15
+ import gradio as gr
16
+
17
+
18
+ gr.close_all()
19
+ demo = gr.Interface(fn=summarize,
20
+ inputs=[gr.Textbox(label="Text to summarize", lines=6)],
21
+ outputs=[gr.Textbox(label="Result", lines=3)],
22
+ title="Text summarization with distilbart-cnn",
23
+ description="Summarize any text using the `sshleifer/distilbart-cnn-12-6` model under the hood!"
24
+ )
25
+ demo.launch(share=True,debug=True)
26
+
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ torch
2
+ transformers
3
+ gradio