Update app.py
Browse files
app.py
CHANGED
|
@@ -209,11 +209,10 @@ def change_textbox(choice):
|
|
| 209 |
|
| 210 |
|
| 211 |
def geometry_change(choice):
|
| 212 |
-
if choice == "Generate Shape from Parameters":
|
| 213 |
-
return [gradio.
|
| 214 |
elif choice == "Pick Shape from Dataset":
|
| 215 |
-
return [gradio.
|
| 216 |
-
|
| 217 |
|
| 218 |
with gradio.Blocks() as demo:
|
| 219 |
with gradio.Accordion("✨ Read about the ML model here! ✨", open=False):
|
|
@@ -232,21 +231,19 @@ with gradio.Blocks() as demo:
|
|
| 232 |
whence_commeth_geometry = gradio.Radio(
|
| 233 |
["Construct Shape from Parameters", "Pick Shape from Dataset"], label="How would you like to generate the shape of the offshore structure for analysis?", value="Construct Shape from Parameters"
|
| 234 |
)
|
| 235 |
-
whence_commeth_geometry.change(fn=geometry_change, inputs=[whence_commeth_geometry], outputs=[
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
|
|
|
|
|
|
|
|
|
| 244 |
|
| 245 |
-
radio.change(fn=change_textbox, inputs=radio, outputs=[height, width, diameter, length])
|
| 246 |
-
with gradio.Accordion("Geometry from Dataset", open=False) as asdfb:
|
| 247 |
-
num = gradio.Number(42, label="data index")
|
| 248 |
-
btn1 = gradio.Button("Select")
|
| 249 |
-
|
| 250 |
with gradio.Column():
|
| 251 |
geo = gradio.Plot(label="Geometry")
|
| 252 |
|
|
|
|
| 209 |
|
| 210 |
|
| 211 |
def geometry_change(choice):
|
| 212 |
+
if choice == "Generate Shape from Parameters":
|
| 213 |
+
return [gradio.Radio.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Number.update(visible=False)]
|
| 214 |
elif choice == "Pick Shape from Dataset":
|
| 215 |
+
return [gradio.Radio.update(visible=False), gradio.Slider.update(visible=False), gradio.Slider.update(visible=False), gradio.Slider.update(visible=False), gradio.Slider.update(visible=False), gradio.Number.update(visible=True)]
|
|
|
|
| 216 |
|
| 217 |
with gradio.Blocks() as demo:
|
| 218 |
with gradio.Accordion("✨ Read about the ML model here! ✨", open=False):
|
|
|
|
| 231 |
whence_commeth_geometry = gradio.Radio(
|
| 232 |
["Construct Shape from Parameters", "Pick Shape from Dataset"], label="How would you like to generate the shape of the offshore structure for analysis?", value="Construct Shape from Parameters"
|
| 233 |
)
|
| 234 |
+
whence_commeth_geometry.change(fn=geometry_change, inputs=[whence_commeth_geometry], outputs=[radio, height, width, diameter, length, num, btn2])
|
| 235 |
+
radio = gradio.Radio(
|
| 236 |
+
["box", "cone", "cylinder", "sphere", "wedge"], label="What kind of shape would you like to generate?", value="box"
|
| 237 |
+
)
|
| 238 |
+
height = gradio.Slider(label="Height", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 239 |
+
width = gradio.Slider(label="Width", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 240 |
+
diameter = gradio.Slider(label="Diameter", interactive=True, minimum=3.0, maximum=10.0, value=6.5, visible=False)
|
| 241 |
+
length = gradio.Slider(label="Length", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 242 |
+
|
| 243 |
+
radio.change(fn=change_textbox, inputs=radio, outputs=[height, width, diameter, length])
|
| 244 |
+
num = gradio.Number(42, label="Type the index of the shape you would like to use or randomly select it.")
|
| 245 |
+
btn1 = gradio.Button("Select")
|
| 246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
with gradio.Column():
|
| 248 |
geo = gradio.Plot(label="Geometry")
|
| 249 |
|