Gradio everywhere!
Browse files
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 [
|
| 239 |
elif choice == "sphere":
|
| 240 |
-
return [
|
| 241 |
elif choice == "cube":
|
| 242 |
-
return [
|
| 243 |
|
| 244 |
|
| 245 |
with gradio.Blocks() as analysis_demo_from_params:
|
| 246 |
with gradio.Row():
|
| 247 |
with gradio.Column():
|
| 248 |
-
radio =
|
| 249 |
["cylinder", "sphere", "cube"], label="What kind of essay would you like to write?"
|
| 250 |
)
|
| 251 |
-
text1 =
|
| 252 |
-
text2 =
|
| 253 |
-
text3 =
|
| 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 |
|