AIROBOHUB commited on
Commit
6da4eb1
·
verified ·
1 Parent(s): 930cfff

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+
4
+ # Use a pipeline as a high-level helper
5
+ from transformers import pipeline
6
+
7
+ # model_Path="../Models/models--sshleifer--distilbart-cnn-12-6/snapshots/a4f8f3ea906ed274767e9906dbaede7531d660ff"
8
+ # text_summary = pipeline("summarization", model=model_Path)
9
+
10
+ text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
11
+
12
+ # text="""William Henry Gates III (born October 28, 1955) is an American businessman and philanthropist best known for
13
+ # co-founding the software company Microsoft with his childhood friend Paul Allen. He later held the positions of chairman,
14
+ # chief executive officer (CEO), president, and chief software architect of the company. Gates was also its largest individual
15
+ # shareholder until May 2014.[a] He was a pioneer of the microcomputer revolution of the 1970s and 1980s."""
16
+
17
+ def summary(input):
18
+ output = text_summary(input)
19
+ return output[0]['summary_text']
20
+
21
+ ui_demo=gr.Interface(
22
+ fn=summary,
23
+ inputs=[gr.Textbox(label='Input text for Summary',lines=5)],
24
+ outputs=[gr.Textbox(label='Summarized Text',lines=2)],
25
+ title='TEXT SUMMARY',
26
+ description='This app will take large text as input and generates summary and dispay'
27
+ )
28
+ ui_demo.launch()