ashutoshzade commited on
Commit
16d8b03
1 Parent(s): 0f96ac0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -1,25 +1,19 @@
1
- #import gradio as gr
2
- #def summarize(input):
3
- # output = get_completion(input)
4
- # return output[0]['summary_text']
5
-
6
- #gr.close_all()
7
- #demo = gr.Interface(fn=summarize, inputs="text", outputs="text")
8
- #demo.launch(share=True, server_port=int(os.environ['PORT1']))
9
- #demo.launch()
10
-
11
  import gradio as gr
12
 
 
 
13
  def summarize(input):
14
  output = get_completion(input)
15
  return output[0]['summary_text']
16
-
17
  gr.close_all()
 
18
  demo = gr.Interface(fn=summarize,
19
  inputs=[gr.Textbox(label="Text to summarize", lines=6)],
20
  outputs=[gr.Textbox(label="Result", lines=3)],
21
  title="Text summarization with distilbart-cnn",
22
  description="Summarize any text using the `shleifer/distilbart-cnn-12-6` model under the hood!"
23
  )
24
- #demo.launch(share=True, server_port=int(os.environ['PORT2']))
25
  demo.launch()
 
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
  gr.close_all()
11
+
12
  demo = gr.Interface(fn=summarize,
13
  inputs=[gr.Textbox(label="Text to summarize", lines=6)],
14
  outputs=[gr.Textbox(label="Result", lines=3)],
15
  title="Text summarization with distilbart-cnn",
16
  description="Summarize any text using the `shleifer/distilbart-cnn-12-6` model under the hood!"
17
  )
18
+
19
  demo.launch()