Restructuring demo
Browse files
app.py
CHANGED
@@ -210,27 +210,7 @@ def synthesis_from_spectrum(df):
|
|
210 |
pred = inverse_net.synthesis_from_spectrum(df.to_numpy()[:, 1:])
|
211 |
return plotly_fig(pred)
|
212 |
|
213 |
-
|
214 |
-
with gradio.Blocks() as analysis_demo:
|
215 |
-
with gradio.Row():
|
216 |
-
with gradio.Column():
|
217 |
-
num = gradio.Number(42, label="data index")
|
218 |
-
btn1 = gradio.Button("Select")
|
219 |
-
with gradio.Column():
|
220 |
-
geo = gradio.Plot(label="Geometry")
|
221 |
-
|
222 |
-
with gradio.Row():
|
223 |
-
btn2 = gradio.Button("Estimate Spectrum")
|
224 |
-
|
225 |
-
with gradio.Row():
|
226 |
-
with gradio.Column():
|
227 |
-
pred = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Predicted")
|
228 |
-
|
229 |
-
with gradio.Column():
|
230 |
-
true = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="True")
|
231 |
-
|
232 |
-
btn1.click(fn=geometry, inputs=[num], outputs=[geo])
|
233 |
-
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
234 |
|
235 |
|
236 |
def change_textbox(choice):
|
@@ -245,102 +225,102 @@ def change_textbox(choice):
|
|
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?", value="box"
|
254 |
-
)
|
255 |
-
height = gradio.Slider(label="Height", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
256 |
-
width = gradio.Slider(label="Width", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
257 |
-
diameter = gradio.Slider(label="Diameter", interactive=True, minimum=3.0, maximum=10.0, value=6.5, visible=False)
|
258 |
-
length = gradio.Slider(label="Length", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
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")
|
264 |
-
|
265 |
-
with gradio.Row():
|
266 |
-
btn2 = gradio.Button("Estimate Spectrum")
|
267 |
-
|
268 |
-
with gradio.Row():
|
269 |
-
with gradio.Column():
|
270 |
-
pred = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Predicted")
|
271 |
-
|
272 |
-
with gradio.Column():
|
273 |
-
true = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="True")
|
274 |
-
|
275 |
-
btn1.click(fn=geometry, inputs=[num], outputs=[geo])
|
276 |
-
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
with gradio.Blocks() as synthesis_demo:
|
281 |
-
with gradio.Row():
|
282 |
-
with gradio.Column():
|
283 |
-
num = gradio.Number(42, label="data index")
|
284 |
-
btn1 = gradio.Button("Select")
|
285 |
-
with gradio.Column():
|
286 |
-
perf = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Performance")
|
287 |
-
|
288 |
-
with gradio.Row():
|
289 |
-
btn2 = gradio.Button("Synthesize Geometry")
|
290 |
-
|
291 |
-
with gradio.Row():
|
292 |
-
with gradio.Column():
|
293 |
-
pred = gradio.Plot(label="Predicted")
|
294 |
-
|
295 |
-
with gradio.Column():
|
296 |
-
true = gradio.Plot(label="True")
|
297 |
-
|
298 |
-
btn1.click(fn=performance, inputs=[num], outputs=[perf])
|
299 |
-
btn2.click(fn=simple_synthesis, inputs=[num], outputs=[pred, true])
|
300 |
-
|
301 |
-
|
302 |
-
with gradio.Blocks() as synthesis_demo2:
|
303 |
-
with gradio.Row():
|
304 |
-
perf = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Performance")
|
305 |
-
|
306 |
-
with gradio.Row():
|
307 |
-
btn2 = gradio.Button("Synthesize Geometry")
|
308 |
-
|
309 |
-
with gradio.Row():
|
310 |
-
pred = gradio.Plot(label="Predicted")
|
311 |
-
|
312 |
-
btn2.click(fn=synthesis_from_spectrum, inputs=[perf], outputs=[pred])
|
313 |
-
|
314 |
-
|
315 |
-
with gradio.Blocks() as synthesis_demo3:
|
316 |
-
with gradio.Row():
|
317 |
-
perf = gradio.DataFrame(headers=['Frequency', 'Surge', 'Heave', 'Pitch'], value=value_net.get_performance().to_numpy().tolist(), overflow_row_behaviour="paginate", max_rows=16, row_counts=(64, "fixed"), col_counts=(3, "fixed"))
|
318 |
-
|
319 |
-
with gradio.Row():
|
320 |
-
btn2 = gradio.Button("Synthesize Geometry")
|
321 |
-
|
322 |
-
with gradio.Row():
|
323 |
-
pred = gradio.Plot(label="Predicted")
|
324 |
-
|
325 |
-
btn2.click(fn=synthesis_from_spectrum, inputs=[perf], outputs=[pred])
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
|
328 |
-
with gradio.
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
|
341 |
-
all_synthesis_demos = gradio.TabbedInterface([synthesis_demo, synthesis_demo2, synthesis_demo3], ["Spectrum from Dataset", "Spectrum from File", "Spectrum from DataFrame"])
|
342 |
-
|
343 |
-
all_analysis_demos = gradio.TabbedInterface([analysis_demo, analysis_demo_from_params], ["Geometry from Data", "Geometry from Parameters"])
|
344 |
-
|
345 |
-
demo = gradio.TabbedInterface([intro, all_analysis_demos, all_synthesis_demos], ["About", "Analysis", "Synthesis"])
|
346 |
demo.launch(debug=True)
|
|
|
210 |
pred = inverse_net.synthesis_from_spectrum(df.to_numpy()[:, 1:])
|
211 |
return plotly_fig(pred)
|
212 |
|
213 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
|
215 |
|
216 |
def change_textbox(choice):
|
|
|
225 |
elif choice == "cone":
|
226 |
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
|
227 |
|
228 |
+
|
229 |
+
with gradio.Blocks() as intro:
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
+
with demo = gradio.Blocks():
|
233 |
+
with gradio.Accordion("✨ Read about the ML model here! ✨", open=False):
|
234 |
+
with gradio.Row():
|
235 |
+
with gradio.Column():
|
236 |
+
gradio.Markdown("# Toward the Rapid Design of Engineered Systems Through Deep Neural Networks")
|
237 |
+
gradio.HTML("Christopher McComb, Carnegie Mellon University")
|
238 |
+
gradio.Markdown("Additive manufacturing is advantageous for producing lightweight components while maintaining function and form. This ability has been bolstered by the introduction of unit lattice cells and the gradation of those cells. In cases where loading varies throughout a part, it may be necessary to use multiple lattice cell types, also known as multi-lattice structures. In such structures, abrupt transitions between geometries may cause stress concentrations, making the boundary a primary failure point; thus, transition regions should be created between each lattice cell type. Although computational approaches have been proposed, smooth transition regions are still difficult to intuit and design, especially between lattices of drastically different geometries. This work demonstrates and assesses a method for using variational autoencoders to automate the creation of transitional lattice cells. In particular, the work focuses on identifying the relationships that exist within the latent space produced by the variational autoencoder. Through computational experimentation, it was found that the smoothness of transition regions was higher when the endpoints were located closer together in the latent space.")
|
239 |
+
with gradio.Column():
|
240 |
+
download = gradio.HTML("<a href=\"M169970.pdf\" style=\"width: 60%; display: block; margin: auto;\"><img src=\"coverpage.png\"></a>")
|
241 |
|
242 |
+
with gradio.Tab("Analysis"):
|
243 |
+
with gradio.Tab("Spectrum from Dataset"):
|
244 |
+
with gradio.Row():
|
245 |
+
with gradio.Column():
|
246 |
+
num = gradio.Number(42, label="data index")
|
247 |
+
btn1 = gradio.Button("Select")
|
248 |
+
with gradio.Column():
|
249 |
+
geo = gradio.Plot(label="Geometry")
|
250 |
+
|
251 |
+
with gradio.Row():
|
252 |
+
btn2 = gradio.Button("Estimate Spectrum")
|
253 |
+
|
254 |
+
with gradio.Row():
|
255 |
+
with gradio.Column():
|
256 |
+
pred = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Predicted")
|
257 |
+
|
258 |
+
with gradio.Column():
|
259 |
+
true = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="True")
|
260 |
+
|
261 |
+
btn1.click(fn=geometry, inputs=[num], outputs=[geo])
|
262 |
+
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
263 |
+
|
264 |
+
with gradio.Tab("Spectrum from DataFrame"):
|
265 |
+
with gradio.Row():
|
266 |
+
perf = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Performance")
|
267 |
+
|
268 |
+
with gradio.Row():
|
269 |
+
btn2 = gradio.Button("Synthesize Geometry")
|
270 |
+
|
271 |
+
with gradio.Row():
|
272 |
+
pred = gradio.Plot(label="Predicted")
|
273 |
+
|
274 |
+
btn2.click(fn=synthesis_from_spectrum, inputs=[perf], outputs=[pred])
|
275 |
|
276 |
+
with gradio.Tab("Synthesis"):
|
277 |
+
with gradio.Tab("Geometry from Dataset"):
|
278 |
+
with gradio.Row():
|
279 |
+
with gradio.Column():
|
280 |
+
num = gradio.Number(42, label="data index")
|
281 |
+
btn1 = gradio.Button("Select")
|
282 |
+
with gradio.Column():
|
283 |
+
perf = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Performance")
|
284 |
|
285 |
+
with gradio.Row():
|
286 |
+
btn2 = gradio.Button("Synthesize Geometry")
|
287 |
+
|
288 |
+
with gradio.Row():
|
289 |
+
with gradio.Column():
|
290 |
+
pred = gradio.Plot(label="Predicted")
|
291 |
+
|
292 |
+
with gradio.Column():
|
293 |
+
true = gradio.Plot(label="True")
|
294 |
+
|
295 |
+
btn1.click(fn=performance, inputs=[num], outputs=[perf])
|
296 |
+
btn2.click(fn=simple_synthesis, inputs=[num], outputs=[pred, true])
|
297 |
+
with gradio.Tab("Geometry from Parameters"):
|
298 |
+
with gradio.Row():
|
299 |
+
with gradio.Column():
|
300 |
+
radio = gradio.Radio(
|
301 |
+
["box", "cone", "cylinder", "sphere", "wedge"], label="What kind of shape would you like to generate?", value="box"
|
302 |
+
)
|
303 |
+
height = gradio.Slider(label="Height", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
304 |
+
width = gradio.Slider(label="Width", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
305 |
+
diameter = gradio.Slider(label="Diameter", interactive=True, minimum=3.0, maximum=10.0, value=6.5, visible=False)
|
306 |
+
length = gradio.Slider(label="Length", interactive=True, minimum=3.0, maximum=10.0, value=6.5)
|
307 |
+
|
308 |
+
radio.change(fn=change_textbox, inputs=radio, outputs=[height, width, diameter, length])
|
309 |
+
|
310 |
+
with gradio.Column():
|
311 |
+
geo = gradio.Plot(label="Geometry")
|
312 |
+
|
313 |
+
with gradio.Row():
|
314 |
+
btn2 = gradio.Button("Estimate Spectrum")
|
315 |
+
|
316 |
+
with gradio.Row():
|
317 |
+
with gradio.Column():
|
318 |
+
pred = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Predicted")
|
319 |
+
|
320 |
+
with gradio.Column():
|
321 |
+
true = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="True")
|
322 |
+
|
323 |
+
btn1.click(fn=geometry, inputs=[num], outputs=[geo])
|
324 |
+
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
325 |
|
|
|
|
|
|
|
|
|
|
|
326 |
demo.launch(debug=True)
|