ccm commited on
Commit
b0ed8c2
·
1 Parent(s): 8ec88c3

Gradio everywhere!

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -235,22 +235,22 @@ with gradio.Blocks() as analysis_demo:
235
 
236
  def change_textbox(choice):
237
  if choice == "cylinder":
238
- return [gr.Slider.update(visible=True), gr.Slider.update(visible=True), gr.Slider.update(visible=False)]
239
  elif choice == "sphere":
240
- return [gr.Slider.update(visible=False), gr.Slider.update(visible=True), gr.Slider.update(visible=False)]
241
  elif choice == "cube":
242
- return [gr.Slider.update(visible=False), gr.Slider.update(visible=False), gr.Slider.update(visible=True)]
243
 
244
 
245
  with gradio.Blocks() as analysis_demo_from_params:
246
  with gradio.Row():
247
  with gradio.Column():
248
- radio = gr.Radio(
249
  ["cylinder", "sphere", "cube"], label="What kind of essay would you like to write?"
250
  )
251
- text1 = gr.Slider(label="Height")
252
- text2 = gr.Slider(label="Radius")
253
- text3 = gr.Slider(label="Side Length")
254
 
255
  radio.change(fn=change_textbox, inputs=radio, outputs=[text1, text2, text3])
256
 
 
235
 
236
  def change_textbox(choice):
237
  if choice == "cylinder":
238
+ return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
239
  elif choice == "sphere":
240
+ return [gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
241
  elif choice == "cube":
242
+ return [gradio.Slider.update(visible=False), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True)]
243
 
244
 
245
  with gradio.Blocks() as analysis_demo_from_params:
246
  with gradio.Row():
247
  with gradio.Column():
248
+ radio = gradio.Radio(
249
  ["cylinder", "sphere", "cube"], label="What kind of essay would you like to write?"
250
  )
251
+ text1 = gradio.Slider(label="Height")
252
+ text2 = gradio.Slider(label="Radius")
253
+ text3 = gradio.Slider(label="Side Length")
254
 
255
  radio.change(fn=change_textbox, inputs=radio, outputs=[text1, text2, text3])
256