Update app.py
Browse files
app.py
CHANGED
|
@@ -227,12 +227,26 @@ with gradio.Blocks() as demo:
|
|
| 227 |
with gradio.Column():
|
| 228 |
download = gradio.HTML("<a href=\"https://huggingface.co/spaces/cmudrc/wecnet/resolve/main/McComb2019_Chapter_TowardTheRapidDesignOfEngineer.pdf\" style=\"width: 60%; display: block; margin: auto;\"><img src=\"https://huggingface.co/spaces/cmudrc/wecnet/resolve/main/coverpage.png\"></a>")
|
| 229 |
|
| 230 |
-
|
| 231 |
-
|
|
|
|
|
|
|
| 232 |
with gradio.Row():
|
| 233 |
with gradio.Column():
|
| 234 |
-
|
| 235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
with gradio.Column():
|
| 237 |
geo = gradio.Plot(label="Geometry")
|
| 238 |
|
|
@@ -248,21 +262,39 @@ with gradio.Blocks() as demo:
|
|
| 248 |
|
| 249 |
btn1.click(fn=geometry, inputs=[num], outputs=[geo])
|
| 250 |
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
| 251 |
-
|
| 252 |
-
with gradio.Tab("
|
| 253 |
with gradio.Row():
|
| 254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
|
| 256 |
with gradio.Row():
|
| 257 |
-
btn2 = gradio.Button("
|
| 258 |
|
| 259 |
with gradio.Row():
|
| 260 |
-
|
|
|
|
| 261 |
|
| 262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
|
| 264 |
-
with gradio.Tab("Synthesis"):
|
| 265 |
-
with gradio.Tab("
|
|
|
|
| 266 |
with gradio.Row():
|
| 267 |
with gradio.Column():
|
| 268 |
num = gradio.Number(42, label="data index")
|
|
@@ -282,33 +314,16 @@ with gradio.Blocks() as demo:
|
|
| 282 |
|
| 283 |
btn1.click(fn=performance, inputs=[num], outputs=[perf])
|
| 284 |
btn2.click(fn=simple_synthesis, inputs=[num], outputs=[pred, true])
|
| 285 |
-
with gradio.Tab("
|
| 286 |
with gradio.Row():
|
| 287 |
-
|
| 288 |
-
radio = gradio.Radio(
|
| 289 |
-
["box", "cone", "cylinder", "sphere", "wedge"], label="What kind of shape would you like to generate?", value="box"
|
| 290 |
-
)
|
| 291 |
-
height = gradio.Slider(label="Height", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 292 |
-
width = gradio.Slider(label="Width", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 293 |
-
diameter = gradio.Slider(label="Diameter", interactive=True, minimum=3.0, maximum=10.0, value=6.5, visible=False)
|
| 294 |
-
length = gradio.Slider(label="Length", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 295 |
-
|
| 296 |
-
radio.change(fn=change_textbox, inputs=radio, outputs=[height, width, diameter, length])
|
| 297 |
-
|
| 298 |
-
with gradio.Column():
|
| 299 |
-
geo = gradio.Plot(label="Geometry")
|
| 300 |
|
| 301 |
with gradio.Row():
|
| 302 |
-
btn2 = gradio.Button("
|
| 303 |
|
| 304 |
with gradio.Row():
|
| 305 |
-
|
| 306 |
-
pred = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Predicted")
|
| 307 |
-
|
| 308 |
-
with gradio.Column():
|
| 309 |
-
true = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="True")
|
| 310 |
|
| 311 |
-
|
| 312 |
-
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
| 313 |
|
| 314 |
demo.launch()
|
|
|
|
| 227 |
with gradio.Column():
|
| 228 |
download = gradio.HTML("<a href=\"https://huggingface.co/spaces/cmudrc/wecnet/resolve/main/McComb2019_Chapter_TowardTheRapidDesignOfEngineer.pdf\" style=\"width: 60%; display: block; margin: auto;\"><img src=\"https://huggingface.co/spaces/cmudrc/wecnet/resolve/main/coverpage.png\"></a>")
|
| 229 |
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
with gradio.Tab("Analysis"):
|
| 233 |
+
with gradio.Tab("Geometry from Dataset"):
|
| 234 |
with gradio.Row():
|
| 235 |
with gradio.Column():
|
| 236 |
+
with gradio.Row("Label"):
|
| 237 |
+
num = gradio.Number(42, label="data index")
|
| 238 |
+
btn1 = gradio.Button("Select")
|
| 239 |
+
with gradio.Row():
|
| 240 |
+
radio = gradio.Radio(
|
| 241 |
+
["box", "cone", "cylinder", "sphere", "wedge"], label="What kind of shape would you like to generate?", value="box"
|
| 242 |
+
)
|
| 243 |
+
height = gradio.Slider(label="Height", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 244 |
+
width = gradio.Slider(label="Width", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 245 |
+
diameter = gradio.Slider(label="Diameter", interactive=True, minimum=3.0, maximum=10.0, value=6.5, visible=False)
|
| 246 |
+
length = gradio.Slider(label="Length", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 247 |
+
|
| 248 |
+
radio.change(fn=change_textbox, inputs=radio, outputs=[height, width, diameter, length])
|
| 249 |
+
|
| 250 |
with gradio.Column():
|
| 251 |
geo = gradio.Plot(label="Geometry")
|
| 252 |
|
|
|
|
| 262 |
|
| 263 |
btn1.click(fn=geometry, inputs=[num], outputs=[geo])
|
| 264 |
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
| 265 |
+
|
| 266 |
+
with gradio.Tab("Geometry from Parameters"):
|
| 267 |
with gradio.Row():
|
| 268 |
+
with gradio.Column():
|
| 269 |
+
radio = gradio.Radio(
|
| 270 |
+
["box", "cone", "cylinder", "sphere", "wedge"], label="What kind of shape would you like to generate?", value="box"
|
| 271 |
+
)
|
| 272 |
+
height = gradio.Slider(label="Height", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 273 |
+
width = gradio.Slider(label="Width", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 274 |
+
diameter = gradio.Slider(label="Diameter", interactive=True, minimum=3.0, maximum=10.0, value=6.5, visible=False)
|
| 275 |
+
length = gradio.Slider(label="Length", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
| 276 |
+
|
| 277 |
+
radio.change(fn=change_textbox, inputs=radio, outputs=[height, width, diameter, length])
|
| 278 |
+
|
| 279 |
+
with gradio.Column():
|
| 280 |
+
geo = gradio.Plot(label="Geometry")
|
| 281 |
|
| 282 |
with gradio.Row():
|
| 283 |
+
btn2 = gradio.Button("Estimate Spectrum")
|
| 284 |
|
| 285 |
with gradio.Row():
|
| 286 |
+
with gradio.Column():
|
| 287 |
+
pred = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Predicted")
|
| 288 |
|
| 289 |
+
with gradio.Column():
|
| 290 |
+
true = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="True")
|
| 291 |
+
|
| 292 |
+
btn1.click(fn=geometry, inputs=[num], outputs=[geo])
|
| 293 |
+
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
| 294 |
|
| 295 |
+
with gradio.Tab("Synthesis"):
|
| 296 |
+
with gradio.Tab("Spectrum from Dataset"):
|
| 297 |
+
|
| 298 |
with gradio.Row():
|
| 299 |
with gradio.Column():
|
| 300 |
num = gradio.Number(42, label="data index")
|
|
|
|
| 314 |
|
| 315 |
btn1.click(fn=performance, inputs=[num], outputs=[perf])
|
| 316 |
btn2.click(fn=simple_synthesis, inputs=[num], outputs=[pred, true])
|
| 317 |
+
with gradio.Tab("Spectrum from DataFrame"):
|
| 318 |
with gradio.Row():
|
| 319 |
+
perf = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Performance")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
|
| 321 |
with gradio.Row():
|
| 322 |
+
btn2 = gradio.Button("Synthesize Geometry")
|
| 323 |
|
| 324 |
with gradio.Row():
|
| 325 |
+
pred = gradio.Plot(label="Predicted")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 326 |
|
| 327 |
+
btn2.click(fn=synthesis_from_spectrum, inputs=[perf], outputs=[pred])
|
|
|
|
| 328 |
|
| 329 |
demo.launch()
|