Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,6 @@ nltk.download('punkt')
|
|
| 6 |
from transformers import pipeline
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
-
|
| 10 |
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0'
|
| 11 |
|
| 12 |
config = Config()
|
|
@@ -45,9 +44,10 @@ io2 = gr.Interface.load("huggingface/facebook/bart-large-cnn")
|
|
| 45 |
io3 = gr.Interface.load("huggingface/google/pegasus-xsum")
|
| 46 |
io4 = gr.Interface.load("huggingface/sshleifer/distilbart-cnn-6-6")
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
| 51 |
|
| 52 |
iface.launch()
|
| 53 |
|
|
@@ -70,21 +70,19 @@ sample_url = [['https://www.technologyreview.com/2021/07/22/1029973/deepmind-alp
|
|
| 70 |
['https://www.technologyreview.com/2021/07/21/1029860/disability-rights-employment-discrimination-ai-hiring/'],
|
| 71 |
['https://www.technologyreview.com/2021/07/09/1028140/ai-voice-actors-sound-human/']]
|
| 72 |
|
| 73 |
-
desc =
|
| 74 |
Let Hugging Face models summarize articles for you.
|
| 75 |
Note: Shorter articles generate faster summaries.
|
| 76 |
This summarizer uses bart-large-cnn model by Facebook
|
| 77 |
'''
|
| 78 |
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
description=desc,
|
| 88 |
-
examples=sample_url)
|
| 89 |
|
| 90 |
iface.launch()
|
|
|
|
| 6 |
from transformers import pipeline
|
| 7 |
import gradio as gr
|
| 8 |
|
|
|
|
| 9 |
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0'
|
| 10 |
|
| 11 |
config = Config()
|
|
|
|
| 44 |
io3 = gr.Interface.load("huggingface/google/pegasus-xsum")
|
| 45 |
io4 = gr.Interface.load("huggingface/sshleifer/distilbart-cnn-6-6")
|
| 46 |
|
| 47 |
+
# Use Parallel and Series directly from gradio
|
| 48 |
+
iface = gr.Parallel(io1, io2, io3, io4,
|
| 49 |
+
theme='huggingface',
|
| 50 |
+
inputs=gr.inputs.Textbox(lines=10, label="Text"))
|
| 51 |
|
| 52 |
iface.launch()
|
| 53 |
|
|
|
|
| 70 |
['https://www.technologyreview.com/2021/07/21/1029860/disability-rights-employment-discrimination-ai-hiring/'],
|
| 71 |
['https://www.technologyreview.com/2021/07/09/1028140/ai-voice-actors-sound-human/']]
|
| 72 |
|
| 73 |
+
desc = '''
|
| 74 |
Let Hugging Face models summarize articles for you.
|
| 75 |
Note: Shorter articles generate faster summaries.
|
| 76 |
This summarizer uses bart-large-cnn model by Facebook
|
| 77 |
'''
|
| 78 |
|
| 79 |
+
# Use Parallel and Series directly from gradio
|
| 80 |
+
iface = gr.Series(extractor, summarizer,
|
| 81 |
+
inputs=gr.inputs.Textbox(lines=2, label='URL'),
|
| 82 |
+
outputs='text',
|
| 83 |
+
title='News Summarizer',
|
| 84 |
+
theme='huggingface',
|
| 85 |
+
description=desc,
|
| 86 |
+
examples=sample_url)
|
|
|
|
|
|
|
| 87 |
|
| 88 |
iface.launch()
|