paula-st commited on
Commit
7990cff
·
verified ·
1 Parent(s): 87d69b7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+ get_completion = pipeline("summarization", model="shleifer/distilbart-cnn-12-6")
4
+
5
+ def summarize(input):
6
+ output = get_completion(input)
7
+ return output[0]['summary_text']
8
+
9
+ text = ('''The tower is 324 metres (1,063 ft) tall, about the same height
10
+ as an 81-storey building, and the tallest structure in Paris.
11
+ Its base is square, measuring 125 metres (410 ft) on each side.
12
+ During its construction, the Eiffel Tower surpassed the Washington
13
+ Monument to become the tallest man-made structure in the world,
14
+ a title it held for 41 years until the Chrysler Building
15
+ in New York City was finished in 1930. It was the first structure
16
+ to reach a height of 300 metres. Due to the addition of a broadcasting
17
+ aerial at the top of the tower in 1957, it is now taller than the
18
+ Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the
19
+ Eiffel Tower is the second tallest free-standing structure in France
20
+ after the Millau Viaduct.''')
21
+
22
+ get_completion(text)