7jimmy commited on
Commit
8ee43ad
1 Parent(s): e67e63f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -15
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
- iface = Parallel(io1, io2, io3, io4,
49
- theme='huggingface',
50
- inputs = gr.inputs.Textbox(lines=10, label="Text"))
 
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
- iface = Series(extractor, summarizer,
80
- inputs=gr.inputs.Textbox(
81
- lines=2,
82
- label='URL'
83
- ),
84
- outputs='text',
85
- title='News Summarizer',
86
- theme='huggingface',
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()