liamvbetts commited on
Commit
5d174b9
1 Parent(s): e673826

pull random change

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -20,18 +20,19 @@ def get_random_article():
20
  val_article = val_example['article'][0][:512]
21
  return val_article
22
 
 
 
 
23
  # Create Gradio interface
24
- input_text = gr.Textbox(lines=10, label="Input Text")
25
  output_text = gr.Textbox(label="Summary")
26
- random_article_button = gr.Button("Load Random Article")
27
-
28
- def update_input_text():
29
- return get_random_article()
30
 
31
  gr.Interface(
32
  fn=summarize,
33
- inputs=[input_text, gr.components.Button("Load Random Article").click(update_input_text, [], input_text)],
34
  outputs=output_text,
35
  title="News Summary App",
36
- description="Enter a news text and get its summary, or load a random article from the validation set."
37
- ).launch()
 
 
20
  val_article = val_example['article'][0][:512]
21
  return val_article
22
 
23
+ def update_article_input():
24
+ return get_random_article()
25
+
26
  # Create Gradio interface
27
+ input_text = gr.Textbox(lines=10, label="Input Text", value="")
28
  output_text = gr.Textbox(label="Summary")
29
+ load_article_button = gr.Button("Load Random Article")
 
 
 
30
 
31
  gr.Interface(
32
  fn=summarize,
33
+ inputs=[input_text, load_article_button],
34
  outputs=output_text,
35
  title="News Summary App",
36
+ description="Enter a news text and get its summary, or load a random article from the validation set.",
37
+ live=True
38
+ ).add_event("click", update_article_input, inputs=None, outputs=input_text, elem_id=load_article_button.elem_id).launch()