root commited on
Commit
fc2865d
·
1 Parent(s): 38eab23

add facebook bart large cnn

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -1,5 +1,12 @@
1
  import gradio as gr
2
- def greet(name):
3
- return "Hello " + name + "!!"
4
 
5
- gr.Interface(fn=greet, inputs="text", outputs="text").launch()
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
 
3
 
4
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
5
+
6
+ def greet(Article):
7
+ return summarizer(Article, max_length=130, min_length=30, do_sample=False)[0]['summary_text']
8
+
9
+ gradio_app = gr.Interface(fn=greet, inputs="text", outputs="text")
10
+
11
+ if __name__ == "__main__":
12
+ gradio_app.launch()