Update app.py
Browse files
app.py
CHANGED
@@ -42,15 +42,24 @@ with gr.Blocks() as demo:
|
|
42 |
|
43 |
radio = gr.Radio(["show", "hide"], label="Choose")
|
44 |
text = gr.Textbox(label="This text only shows when 'show' is selected.", visible=False)
|
45 |
-
|
46 |
|
47 |
-
def
|
48 |
value = radio # Get the selected value from the radio button
|
49 |
if value == "show":
|
50 |
return gr.Textbox(visible=bool(1)) #make it visible
|
51 |
else:
|
52 |
return gr.Textbox(visible=bool(0))
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
# Define function to update visibility based on dataset choice
|
56 |
def update_visibility():
|
|
|
42 |
|
43 |
radio = gr.Radio(["show", "hide"], label="Choose")
|
44 |
text = gr.Textbox(label="This text only shows when 'show' is selected.", visible=False)
|
45 |
+
taxt = gr.Textbox(label="This text only shows when 'hide' is selected.", visible=True)
|
46 |
|
47 |
+
def open_visibility(radio): # Accept the event argument, even if not used
|
48 |
value = radio # Get the selected value from the radio button
|
49 |
if value == "show":
|
50 |
return gr.Textbox(visible=bool(1)) #make it visible
|
51 |
else:
|
52 |
return gr.Textbox(visible=bool(0))
|
53 |
+
|
54 |
+
def close_visibility(radio):
|
55 |
+
value = radio
|
56 |
+
if value == "hide":
|
57 |
+
return gr.Textbox(visible=bool(1)) #make it visible
|
58 |
+
else:
|
59 |
+
return gr.Textbox(visible=bool(0))
|
60 |
+
|
61 |
+
radio.change(open_visibilita, radio, text)
|
62 |
+
radio.change(close_visibilita, radio, taxt)
|
63 |
|
64 |
# Define function to update visibility based on dataset choice
|
65 |
def update_visibility():
|