tykiww commited on
Commit
e3e35e9
·
verified ·
1 Parent(s): 15d1f35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -13
app.py CHANGED
@@ -40,26 +40,25 @@ with gr.Blocks() as demo:
40
 
41
 
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_visibility, radio, text)
62
- radio.change(close_visibility, radio, taxt)
63
 
64
  # Define function to update visibility based on dataset choice
65
  def update_visibility():
 
40
 
41
 
42
 
43
+
44
+
 
45
 
46
+ def dropdown_visibility(radio): # Accept the event argument, even if not used
47
  value = radio # Get the selected value from the radio button
48
+ if value == "Predefined Dataset":
49
+ return gr.Dropdown(visible=bool(1))
50
  else:
51
+ return gr.Dropdown(visible=bool(0))
52
 
53
+ def upload_visibility(radio):
54
  value = radio
55
+ if value == "Upload Your Own":
56
+ return gr.UploadButton(visible=bool(1)) #make it visible
57
  else:
58
+ return gr.UploadButton(visible=bool(0))
59
 
60
+ radio.change(dropdown_visibility, dataset_choice, dataset_predefined)
61
+ radio.change(upload_visibility, dataset_choice, dataset_upload)
62
 
63
  # Define function to update visibility based on dataset choice
64
  def update_visibility():