area444 commited on
Commit
61f1655
·
verified ·
1 Parent(s): 536987a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -16,6 +16,10 @@ def hide_panel():
16
  def show_panel_1():
17
  return gr.update(visible=True) # Show Panel 1
18
 
 
 
 
 
19
  # Create the Gradio interface
20
  with gr.Blocks() as demo:
21
  # Textbox where the first word is entered
@@ -38,7 +42,7 @@ with gr.Blocks() as demo:
38
  gr.Textbox(value="Panel activado. Se escribieron 'user' y 'casa'.", label="Resultado")
39
  # Add a second button inside Panel 2 to hide the panel and show Panel 1 again
40
  btn_2 = gr.Button("Ocultar el Panel", visible=True)
41
- btn_2.click([hide_panel, show_panel_1], outputs=[panel_2, panel_1]) # Hide Panel 2 and show Panel 1
42
 
43
  # Configure the buttons and the panel visibility
44
  btn_1.click(check_words, inputs=[user_text, input_text], outputs=[panel_2, panel_1]) # Hide Panel 1 and show Panel 2
 
16
  def show_panel_1():
17
  return gr.update(visible=True) # Show Panel 1
18
 
19
+ # Wrapper function that calls both hide_panel and show_panel_1
20
+ def hide_and_show_panel():
21
+ return hide_panel(), show_panel_1()
22
+
23
  # Create the Gradio interface
24
  with gr.Blocks() as demo:
25
  # Textbox where the first word is entered
 
42
  gr.Textbox(value="Panel activado. Se escribieron 'user' y 'casa'.", label="Resultado")
43
  # Add a second button inside Panel 2 to hide the panel and show Panel 1 again
44
  btn_2 = gr.Button("Ocultar el Panel", visible=True)
45
+ btn_2.click(hide_and_show_panel, outputs=[panel_2, panel_1]) # Call the wrapper function to hide Panel 2 and show Panel 1
46
 
47
  # Configure the buttons and the panel visibility
48
  btn_1.click(check_words, inputs=[user_text, input_text], outputs=[panel_2, panel_1]) # Hide Panel 1 and show Panel 2