Update app.py
Browse files
app.py
CHANGED
|
@@ -235,24 +235,29 @@ with gradio.Blocks() as analysis_demo:
|
|
| 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 == "
|
| 242 |
-
return [gradio.Slider.update(visible=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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", "
|
| 250 |
)
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
|
|
|
| 254 |
|
| 255 |
-
radio.change(fn=change_textbox, inputs=radio, outputs=[
|
| 256 |
|
| 257 |
with gradio.Column():
|
| 258 |
geo = gradio.Plot(label="Geometry")
|
|
|
|
| 235 |
|
| 236 |
def change_textbox(choice):
|
| 237 |
if choice == "cylinder":
|
| 238 |
+
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), 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=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
|
| 241 |
+
elif choice == "box":
|
| 242 |
+
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True)]
|
| 243 |
+
elif choice == "wedge":
|
| 244 |
+
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True)]
|
| 245 |
+
elif choice == "cone":
|
| 246 |
+
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
|
| 247 |
|
| 248 |
|
| 249 |
with gradio.Blocks() as analysis_demo_from_params:
|
| 250 |
with gradio.Row():
|
| 251 |
with gradio.Column():
|
| 252 |
radio = gradio.Radio(
|
| 253 |
+
["box", "cone", "cylinder", "sphere", "wedge"], label="What kind of shape would you like to generate?"
|
| 254 |
)
|
| 255 |
+
height = gradio.Slider(label="Height")
|
| 256 |
+
width = gradio.Slider(label="Width")
|
| 257 |
+
diameter = gradio.Slider(label="Diameter")
|
| 258 |
+
length = gradio.Slider(label="Length")
|
| 259 |
|
| 260 |
+
radio.change(fn=change_textbox, inputs=radio, outputs=[height, width, diameter, length])
|
| 261 |
|
| 262 |
with gradio.Column():
|
| 263 |
geo = gradio.Plot(label="Geometry")
|