rayl-aoit commited on
Commit
3313aa0
·
verified ·
1 Parent(s): b24c709

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -26,6 +26,9 @@ def summarize(input):
26
  summary_translated = translate(summary_origin,'en','fr')
27
  return summary_origin, summary_translated[0]
28
 
 
 
 
29
  def merge_tokens(tokens):
30
  merged_tokens = []
31
  for token in tokens:
@@ -109,6 +112,7 @@ with playground:
109
 
110
  with gr.Column(scale=1):
111
  text_pipeline_button = gr.Button(value="Process")
 
112
 
113
  with gr.Row():
114
  with gr.Column():
@@ -123,11 +127,9 @@ with playground:
123
  "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.",
124
  "Tower Bridge is a Grade I listed combined bascule, suspension, and, until 1960, cantilever bridge[1] in London, built between 1886 and 1894, designed by Horace Jones and engineered by John Wolfe Barry with the help of Henry Marc Brunel.[2] It crosses the River Thames close to the Tower of London and is one of five London bridges owned and maintained by the City Bridge Foundation, a charitable trust founded in 1282. The bridge was constructed to connect the 39 per cent of London's population that lived east of London Bridge, while allowing shipping to access the Pool of London between the Tower of London and London Bridge. The bridge was opened by Edward, Prince of Wales and Alexandra, Princess of Wales on 30 June 1894."
125
  ], inputs=[source_text], outputs=[summary_textoutput, translated_textbox], run_on_click=True, cache_examples=True, fn=summarize)
126
-
127
-
128
- text_pipeline_button.click(summarize,
129
- inputs=[source_text],
130
- outputs=[summary_textoutput, translated_textbox])
131
 
132
  with gr.TabItem("Name Entity"):
133
  with gr.Row():
 
26
  summary_translated = translate(summary_origin,'en','fr')
27
  return summary_origin, summary_translated[0]
28
 
29
+ def reset_input():
30
+ return ""
31
+
32
  def merge_tokens(tokens):
33
  merged_tokens = []
34
  for token in tokens:
 
112
 
113
  with gr.Column(scale=1):
114
  text_pipeline_button = gr.Button(value="Process")
115
+ text_reset_button = gr.Button(value="Clear")
116
 
117
  with gr.Row():
118
  with gr.Column():
 
127
  "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.",
128
  "Tower Bridge is a Grade I listed combined bascule, suspension, and, until 1960, cantilever bridge[1] in London, built between 1886 and 1894, designed by Horace Jones and engineered by John Wolfe Barry with the help of Henry Marc Brunel.[2] It crosses the River Thames close to the Tower of London and is one of five London bridges owned and maintained by the City Bridge Foundation, a charitable trust founded in 1282. The bridge was constructed to connect the 39 per cent of London's population that lived east of London Bridge, while allowing shipping to access the Pool of London between the Tower of London and London Bridge. The bridge was opened by Edward, Prince of Wales and Alexandra, Princess of Wales on 30 June 1894."
129
  ], inputs=[source_text], outputs=[summary_textoutput, translated_textbox], run_on_click=True, cache_examples=True, fn=summarize)
130
+
131
+ text_pipeline_button.click(summarize, inputs=[source_text], outputs=[summary_textoutput, translated_textbox])
132
+ text_reset_button.click(reset_input, outputs=[source_text])
 
 
133
 
134
  with gr.TabItem("Name Entity"):
135
  with gr.Row():