Spaces:
Runtime error
Runtime error
Commit
·
e844261
1
Parent(s):
a4d32fc
title/description + README
Browse files
README.md
CHANGED
@@ -9,6 +9,10 @@ python_version: 3.9.13
|
|
9 |
app_file: app.py
|
10 |
pinned: false
|
11 |
license: openrail
|
|
|
|
|
12 |
---
|
13 |
|
14 |
-
|
|
|
|
|
|
9 |
app_file: app.py
|
10 |
pinned: false
|
11 |
license: openrail
|
12 |
+
models:
|
13 |
+
- facebook/bart-large-cnn
|
14 |
---
|
15 |
|
16 |
+
# Text summarizer
|
17 |
+
|
18 |
+
Shortening texts using `facebook/bart-large-cnn`
|
app.py
CHANGED
@@ -4,7 +4,7 @@ from transformers import pipeline
|
|
4 |
def summarize_text(text, min_length, max_length):
|
5 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
6 |
summary = summarizer(text, max_length, min_length, do_sample=False)
|
7 |
-
print("summary", summary)
|
8 |
return summary[0]["summary_text"]
|
9 |
|
10 |
gradio_interface = gradio.Interface(
|
@@ -23,6 +23,9 @@ Slowly we pan downwards revealing the city that spreads below. A glittering cong
|
|
23 |
As we descend, the sunlight is blocked out and street lights & neon signs take over as illumination. Eventually we reach the upper levels of a plush shopping precinct.
|
24 |
Xmas decorations are everywhere. People are busy buying, ogling, discussing, choosing wisely from the goodies on display. Shoppers are going by laden with superbly packaged goods. The shop windows are full of elaborately boxed and be-ribboned who-knows-what. In one window is a bank of TV sets on the great majority of the screens is the face of Mr. Helpmann the Deputy Minister of Information. He is being interviewed. No-one bothers to listen to Helpmann.""",
|
25 |
30, 130]
|
26 |
-
]
|
|
|
|
|
|
|
27 |
)
|
28 |
gradio_interface.launch()
|
|
|
4 |
def summarize_text(text, min_length, max_length):
|
5 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
6 |
summary = summarizer(text, max_length, min_length, do_sample=False)
|
7 |
+
print("** summary", summary)
|
8 |
return summary[0]["summary_text"]
|
9 |
|
10 |
gradio_interface = gradio.Interface(
|
|
|
23 |
As we descend, the sunlight is blocked out and street lights & neon signs take over as illumination. Eventually we reach the upper levels of a plush shopping precinct.
|
24 |
Xmas decorations are everywhere. People are busy buying, ogling, discussing, choosing wisely from the goodies on display. Shoppers are going by laden with superbly packaged goods. The shop windows are full of elaborately boxed and be-ribboned who-knows-what. In one window is a bank of TV sets on the great majority of the screens is the face of Mr. Helpmann the Deputy Minister of Information. He is being interviewed. No-one bothers to listen to Helpmann.""",
|
25 |
30, 130]
|
26 |
+
],
|
27 |
+
title="Text summarizer",
|
28 |
+
description="Shortening texts using `facebook/bart-large-cnn`.",
|
29 |
+
article="© Tom Söderlund 2022"
|
30 |
)
|
31 |
gradio_interface.launch()
|