tykiww commited on
Commit
5aa180d
·
verified ·
1 Parent(s): 68cc4d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -45,21 +45,20 @@ with gr.Blocks() as demo:
45
 
46
 
47
 
48
- def update_visibility(radio): # Accept the event argument, even if not used
 
49
  value = radio.value # Get the selected value from the radio button
50
-
51
  if value == "Predefined Dataset":
52
- predef = gr.Dropdown.update(visible=bool(1))
53
- upload = gr.UploadButton.update(visible=bool(0))
54
  elif value == "Upload Your Own":
55
- predef = gr.Dropdown.update(visible=bool(0))
56
- upload = gr.UploadButton.update(visible=bool(1))
57
- return predef, upload # Return both components
58
-
59
- dataset_predefined, dataset_upload = dataset_choice.change(update_visibility, dataset_choice, dataset_upload)
60
-
61
-
62
 
 
 
 
63
 
64
  # Update visibility based on user choice
65
  #dataset_predefined, dataset_upload = dataset_choice.change(update_dataset_visibility, inputs=[dataset_choice], outputs=[dataset_predefined, dataset_upload])
 
45
 
46
 
47
 
48
+ # Update visibility based on user choice
49
+ def update_visibility(radio):
50
  value = radio.value # Get the selected value from the radio button
51
+
52
  if value == "Predefined Dataset":
53
+ dataset_predefined.visible = True
54
+ dataset_upload.visible = False
55
  elif value == "Upload Your Own":
56
+ dataset_predefined.visible = False
57
+ dataset_upload.visible = True
 
 
 
 
 
58
 
59
+ # Bind the update_visibility function to the change event of dataset_choice
60
+ dataset_choice.change(update_visibility)
61
+
62
 
63
  # Update visibility based on user choice
64
  #dataset_predefined, dataset_upload = dataset_choice.change(update_dataset_visibility, inputs=[dataset_choice], outputs=[dataset_predefined, dataset_upload])