Spaces:
Runtime error
Runtime error
Modified app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from gradio.mix import Parallel, Series
|
|
5 |
|
6 |
|
7 |
|
8 |
-
def
|
9 |
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0'
|
10 |
config = Config()
|
11 |
config.browser_user_agent = USER_AGENT
|
@@ -17,14 +17,14 @@ def extract_article_text(url):
|
|
17 |
text = article.text
|
18 |
return text
|
19 |
|
20 |
-
extractor = gr.Interface(
|
21 |
summarizer = gr.Interface.load("huggingface/facebook/bart-large-cnn")
|
22 |
|
23 |
sample_url = [['https://www.cp24.com/news/ontario-reports-481-new-covid-19-cases-1-death-1.5667950'],
|
24 |
]
|
25 |
|
26 |
desc = '''
|
27 |
-
|
28 |
'''
|
29 |
|
30 |
iface = Series(extractor, summarizer,
|
@@ -35,6 +35,7 @@ iface = Series(extractor, summarizer,
|
|
35 |
outputs = 'text',
|
36 |
title = 'News Summarizer',
|
37 |
theme = 'grass',
|
|
|
38 |
description = desc,
|
39 |
examples=sample_url)
|
40 |
|
|
|
5 |
|
6 |
|
7 |
|
8 |
+
def extrac_text(url):
|
9 |
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0'
|
10 |
config = Config()
|
11 |
config.browser_user_agent = USER_AGENT
|
|
|
17 |
text = article.text
|
18 |
return text
|
19 |
|
20 |
+
extractor = gr.Interface(extrac_text, 'text', 'text')
|
21 |
summarizer = gr.Interface.load("huggingface/facebook/bart-large-cnn")
|
22 |
|
23 |
sample_url = [['https://www.cp24.com/news/ontario-reports-481-new-covid-19-cases-1-death-1.5667950'],
|
24 |
]
|
25 |
|
26 |
desc = '''
|
27 |
+
The news summarizer app uses bart-large-cnn model by Facebook to summarize the text of a news article.
|
28 |
'''
|
29 |
|
30 |
iface = Series(extractor, summarizer,
|
|
|
35 |
outputs = 'text',
|
36 |
title = 'News Summarizer',
|
37 |
theme = 'grass',
|
38 |
+
layout = 'vertical',
|
39 |
description = desc,
|
40 |
examples=sample_url)
|
41 |
|