Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,17 +4,20 @@ from transformers import pipeline
|
|
4 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
5 |
|
6 |
|
7 |
-
def summarize(text):
|
8 |
-
return summarizer(text, max_length=
|
9 |
|
10 |
|
11 |
-
title = "
|
12 |
description = "Abstractive Text Summarization using Hugging Face transformers."
|
13 |
article = "<div style='text-align: center; max-width:800px; margin:10px auto;'><p></p><p>Sources: <a href='https://github.com/huggingface/transformers/' target='_blank'>Transformers</a>: Machine Learning with pretrained models</p><p style='text-align: center'> With help of <a href='https://fxstrengthmeter.com/' target='_blank'>Currency Strength meter</a>: live indicator with real-time market data that compares a currency with other major currencies</p></div>"
|
14 |
|
15 |
gr.Interface(
|
16 |
fn=summarize,
|
17 |
-
inputs=
|
|
|
|
|
|
|
18 |
outputs=gr.outputs.Textbox(type="text", label="Summary"),
|
19 |
title=title,
|
20 |
description=description,
|
|
|
4 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
5 |
|
6 |
|
7 |
+
def summarize(text, slen):
|
8 |
+
return summarizer(text, max_length=slen, min_length=50)[0]["summary_text"]
|
9 |
|
10 |
|
11 |
+
title = "Bart large CNN Summarizer"
|
12 |
description = "Abstractive Text Summarization using Hugging Face transformers."
|
13 |
article = "<div style='text-align: center; max-width:800px; margin:10px auto;'><p></p><p>Sources: <a href='https://github.com/huggingface/transformers/' target='_blank'>Transformers</a>: Machine Learning with pretrained models</p><p style='text-align: center'> With help of <a href='https://fxstrengthmeter.com/' target='_blank'>Currency Strength meter</a>: live indicator with real-time market data that compares a currency with other major currencies</p></div>"
|
14 |
|
15 |
gr.Interface(
|
16 |
fn=summarize,
|
17 |
+
inputs=[
|
18 |
+
gr.inputs.Textbox(label="Input Text", lines=12, placeholder="Enter text to summarize here"),
|
19 |
+
gr.inputs.Slider(60, 1000, value=400, label="Max summary length")
|
20 |
+
],
|
21 |
outputs=gr.outputs.Textbox(type="text", label="Summary"),
|
22 |
title=title,
|
23 |
description=description,
|