fluidbinary commited on
Commit
54576e7
1 Parent(s): 3b856f8

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Creating the summarizer from pipeline
5
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
6
+
7
+ # Create the summarize function passing in the desired parameters.
8
+ def summarize(article):
9
+ return f'{summarizer(article, min_length=30, max_length=200, do_sample=False)[0]["summary_text"]}'
10
+
11
+ # Run the application
12
+ app = gr.Interface(fn=summarize, inputs="text", outputs="text")
13
+ app.launch()