Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,12 +3,20 @@ from transformers import pipeline
|
|
3 |
|
4 |
summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
|
5 |
|
|
|
6 |
def summarize(text):
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
title = "OpenAI Summarizer"
|
11 |
description = "Abstractive Text Summarization using Hugging Face transformers."
|
12 |
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>"
|
13 |
-
|
14 |
-
gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
|
5 |
|
6 |
+
|
7 |
def summarize(text):
|
8 |
+
return summarizer(text, max_length=400, min_length=50)[0]["summary_text"]
|
9 |
+
|
10 |
+
|
11 |
title = "OpenAI 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=gr.inputs.Textbox(lines=12, placeholder="Enter text to summarize here"),
|
18 |
+
outputs="text",
|
19 |
+
title=title,
|
20 |
+
description=description,
|
21 |
+
article=article,
|
22 |
+
).launch()
|