vinni1484 commited on
Commit
5d16aaf
1 Parent(s): a5f30a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -31
app.py CHANGED
@@ -1,32 +1,7 @@
1
  import gradio as gr
2
- from gradio.mix import Parallel, Series
3
- from transformers import pipeline
4
- import wikipedia
5
-
6
- def extract_article_text(url):
7
- text = wikipedia.page(pageid=url).content
8
- return text
9
-
10
- extractor = gr.Interface(extract_article_text, 'text', 'text')
11
- summarizer = gr.Interface.load("huggingface/facebook/bart-large-cnn")
12
-
13
- sample_url = [[1691376],[45199431]]
14
-
15
- description = '''
16
- This application summarizes a news article based on the sentences used in the article.
17
- Enter a news article link and submit for a summary.
18
- A shorter news article produces a faster summary. A news article behind a paywall may produce an error.
19
- '''
20
-
21
- iface = Series(extractor, summarizer,
22
- inputs = gr.inputs.Textbox(
23
- lines = 2,
24
- label = 'URL'
25
- ),
26
- outputs = 'text',
27
- title = 'Extractive News Summarizer BART',
28
- theme = 'grass',
29
- description = description,
30
- examples=sample_url)
31
-
32
- iface.launch()
 
1
  import gradio as gr
2
+ title = 'Text Summarization'
3
+ text_ = "The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."
4
+ interface = gr.Interface.load("huggingface/facebook/bart-large-cnn",
5
+ title = title,
6
+ theme = "peach",
7
+ examples = [[text_]]).launch()