Update app.py
Browse files
app.py
CHANGED
@@ -1281,8 +1281,22 @@ def change_textbox(choice, length, height, width, diameter):
|
|
1281 |
elif choice == "cone":
|
1282 |
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Plot.update(fig)]
|
1283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1284 |
|
1285 |
-
import random
|
1286 |
|
1287 |
def geometry_change(choice, choice2, num, length, width, height, diameter):
|
1288 |
if choice == "Construct Shape from Parameters":
|
@@ -1291,7 +1305,7 @@ def geometry_change(choice, choice2, num, length, width, height, diameter):
|
|
1291 |
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), gradio.Timeseries.update(visible=True), gradio.Plot.update(geometry(num))]
|
1292 |
|
1293 |
with gradio.Blocks() as demo:
|
1294 |
-
with gradio.Accordion("✨ Read about the ML model here! ✨", open=False):
|
1295 |
with gradio.Row():
|
1296 |
with gradio.Column():
|
1297 |
gradio.Markdown("# Toward the Rapid Design of Engineered Systems Through Deep Neural Networks")
|
@@ -1338,10 +1352,10 @@ with gradio.Blocks() as demo:
|
|
1338 |
width.change(fn=make_voxels, inputs = [radio, length, height, width, diameter], outputs=[geo])
|
1339 |
diameter.change(fn=make_voxels, inputs = [radio, length, height, width, diameter], outputs=[geo])
|
1340 |
length.change(fn=make_voxels, inputs = [radio, length, height, width, diameter], outputs=[geo])
|
1341 |
-
whence_commeth_geometry.change(fn=geometry_change, inputs=[whence_commeth_geometry
|
1342 |
num.change(fn=geometry, inputs=[num], outputs=[geo])
|
1343 |
|
1344 |
-
btn1.click(fn=
|
1345 |
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
1346 |
|
1347 |
with gradio.Tab("Synthesis"):
|
|
|
1281 |
elif choice == "cone":
|
1282 |
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Plot.update(fig)]
|
1283 |
|
1284 |
+
|
1285 |
+
import random
|
1286 |
+
|
1287 |
+
def randomize_analysis(choice):
|
1288 |
+
if choice == "Construct Shape from Parameters":
|
1289 |
+
length = random.uniform(3.0, 10.0)
|
1290 |
+
height = random.uniform(3.0, 10.0)
|
1291 |
+
width = random.uniform(3.0, 10.0)
|
1292 |
+
diameter = random.uniform(3.0, 10.0)
|
1293 |
+
choice2 = random.sample(["box", "cone", "sphere", "pyramid", "cone"])
|
1294 |
+
return [gradio.Radio.update(choice2), gradio.Slider.update(length), gradio.Slider.update(width), gradio.Slider.update(height), gradio.Slider.update(diameter), gradio.Number.update(), gradio.Plot.update(make_voxels(choice2, length, height, width, diameter))]
|
1295 |
+
elif choice == "Pick Shape from Dataset":
|
1296 |
+
num = random.randint(1, 4999)
|
1297 |
+
return [gradio.Radio.update(), gradio.Slider.update(), gradio.Slider.update(), gradio.Slider.update(), gradio.Slider.update(), gradio.Number.update(), gradio.Timeseries.update(num), gradio.Plot.update(geometry(num))]
|
1298 |
+
|
1299 |
|
|
|
1300 |
|
1301 |
def geometry_change(choice, choice2, num, length, width, height, diameter):
|
1302 |
if choice == "Construct Shape from Parameters":
|
|
|
1305 |
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), gradio.Timeseries.update(visible=True), gradio.Plot.update(geometry(num))]
|
1306 |
|
1307 |
with gradio.Blocks() as demo:
|
1308 |
+
with gradio.Accordion("✨ Read about the underlying ML model here! ✨", open=False):
|
1309 |
with gradio.Row():
|
1310 |
with gradio.Column():
|
1311 |
gradio.Markdown("# Toward the Rapid Design of Engineered Systems Through Deep Neural Networks")
|
|
|
1352 |
width.change(fn=make_voxels, inputs = [radio, length, height, width, diameter], outputs=[geo])
|
1353 |
diameter.change(fn=make_voxels, inputs = [radio, length, height, width, diameter], outputs=[geo])
|
1354 |
length.change(fn=make_voxels, inputs = [radio, length, height, width, diameter], outputs=[geo])
|
1355 |
+
whence_commeth_geometry.change(fn=geometry_change, inputs=[whence_commeth_geometry], outputs=[radio, height, width, diameter, length, num, true, geo])
|
1356 |
num.change(fn=geometry, inputs=[num], outputs=[geo])
|
1357 |
|
1358 |
+
btn1.click(fn=randomize_analysis, inputs=[whence_commeth_geometry], outputs=[radio, length, height, width, diameter, num, geo])
|
1359 |
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
1360 |
|
1361 |
with gradio.Tab("Synthesis"):
|