Update app.py
Browse files
app.py
CHANGED
@@ -1267,17 +1267,18 @@ def synthesis_from_spectrum(df):
|
|
1267 |
|
1268 |
|
1269 |
|
1270 |
-
def change_textbox(choice):
|
|
|
1271 |
if choice == "cylinder":
|
1272 |
-
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
|
1273 |
elif choice == "sphere":
|
1274 |
-
return [gradio.Slider.update(visible=False), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
|
1275 |
elif choice == "box":
|
1276 |
-
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True)]
|
1277 |
elif choice == "wedge":
|
1278 |
-
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True)]
|
1279 |
elif choice == "cone":
|
1280 |
-
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
|
1281 |
|
1282 |
|
1283 |
import random
|
@@ -1313,12 +1314,13 @@ with gradio.Blocks() as demo:
|
|
1313 |
diameter = gradio.Slider(label="Diameter", interactive=True, minimum=3.0, maximum=10.0, value=6.5, visible=False)
|
1314 |
length = gradio.Slider(label="Length", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
1315 |
|
1316 |
-
|
1317 |
num = gradio.Number(42, label="Type the index of the shape you would like to use or randomly select it.", visible=False)
|
1318 |
|
1319 |
btn1 = gradio.Button("Randomize")
|
1320 |
with gradio.Column():
|
1321 |
geo = gradio.Plot(label="Geometry")
|
|
|
1322 |
|
1323 |
with gradio.Row():
|
1324 |
btn2 = gradio.Button("Estimate Spectrum")
|
@@ -1329,9 +1331,11 @@ with gradio.Blocks() as demo:
|
|
1329 |
|
1330 |
with gradio.Column():
|
1331 |
true = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="True")
|
1332 |
-
|
|
|
1333 |
whence_commeth_geometry.change(fn=geometry_change, inputs=[whence_commeth_geometry], outputs=[radio, height, width, diameter, length, num, true])
|
1334 |
num.change(fn=geometry, inputs=[num], outputs=[geo])
|
|
|
1335 |
btn1.click(fn=lambda: random.randint(1, 4999), inputs=[], outputs=[num])
|
1336 |
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
1337 |
|
|
|
1267 |
|
1268 |
|
1269 |
|
1270 |
+
def change_textbox(choice, length, height, width, diameter):
|
1271 |
+
fig = make_voxels(choice, length, height, width, diameter)
|
1272 |
if choice == "cylinder":
|
1273 |
+
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Plot.update(values=fig)]
|
1274 |
elif choice == "sphere":
|
1275 |
+
return [gradio.Slider.update(visible=False), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Plot.update(values=fig)]
|
1276 |
elif choice == "box":
|
1277 |
+
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Plot.update(values=fig)]
|
1278 |
elif choice == "wedge":
|
1279 |
+
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Plot.update(values=fig)]
|
1280 |
elif choice == "cone":
|
1281 |
+
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Plot.update(values=fig)]
|
1282 |
|
1283 |
|
1284 |
import random
|
|
|
1314 |
diameter = gradio.Slider(label="Diameter", interactive=True, minimum=3.0, maximum=10.0, value=6.5, visible=False)
|
1315 |
length = gradio.Slider(label="Length", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
1316 |
|
1317 |
+
|
1318 |
num = gradio.Number(42, label="Type the index of the shape you would like to use or randomly select it.", visible=False)
|
1319 |
|
1320 |
btn1 = gradio.Button("Randomize")
|
1321 |
with gradio.Column():
|
1322 |
geo = gradio.Plot(label="Geometry")
|
1323 |
+
|
1324 |
|
1325 |
with gradio.Row():
|
1326 |
btn2 = gradio.Button("Estimate Spectrum")
|
|
|
1331 |
|
1332 |
with gradio.Column():
|
1333 |
true = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="True")
|
1334 |
+
|
1335 |
+
radio.change(fn=change_textbox, inputs=[radio, length, height, width, diameter], outputs=[height, width, diameter, length, geo])
|
1336 |
whence_commeth_geometry.change(fn=geometry_change, inputs=[whence_commeth_geometry], outputs=[radio, height, width, diameter, length, num, true])
|
1337 |
num.change(fn=geometry, inputs=[num], outputs=[geo])
|
1338 |
+
|
1339 |
btn1.click(fn=lambda: random.randint(1, 4999), inputs=[], outputs=[num])
|
1340 |
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
1341 |
|