Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -258,9 +258,110 @@ with gr.Blocks(css=css_styling, title=page_title, theme=osium_theme) as demo:
|
|
258 |
gr.Markdown("### Interpretation of yield strength prediction")
|
259 |
with gr.Row():
|
260 |
output_interpretation = gr.Plot(label="Interpretation")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
with gr.Row():
|
262 |
gr.Examples([example_inputs], [input_formula, input_phase, input_bccfcc, input_processing, input_microstructure])
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
train_button.click(
|
265 |
fn=train_model,
|
266 |
inputs=[input_csv, target_columns],
|
|
|
258 |
gr.Markdown("### Interpretation of yield strength prediction")
|
259 |
with gr.Row():
|
260 |
output_interpretation = gr.Plot(label="Interpretation")
|
261 |
+
|
262 |
+
elem1 = "%Cr"
|
263 |
+
elem2 = "%V"
|
264 |
+
elem3 = "%Mo"
|
265 |
+
with gr.Row():
|
266 |
+
input_list1 = input_cols.copy()
|
267 |
+
input_list1.remove(elem2)
|
268 |
+
input_list1.remove(elem3)
|
269 |
+
dropdown_1 = gr.Dropdown(label="Fix element 1", choices=input_list1, value=elem1)
|
270 |
+
input_slicer_1 = gr.Slider(
|
271 |
+
label=elem1,
|
272 |
+
minimum=space_dict[elem1]["min"],
|
273 |
+
maximum=space_dict[elem1]["max"],
|
274 |
+
value=space_dict[elem1]["value"],
|
275 |
+
step=space_dict[elem1]["step_display"],
|
276 |
+
)
|
277 |
+
with gr.Row():
|
278 |
+
input_list2 = input_cols.copy()
|
279 |
+
input_list2.remove(elem1)
|
280 |
+
input_list2.remove(elem3)
|
281 |
+
dropdown_2 = gr.Dropdown(label="Fix element 2", choices=input_list2, value=elem2)
|
282 |
+
input_slicer_2 = gr.Slider(
|
283 |
+
label=elem2,
|
284 |
+
minimum=space_dict[elem2]["min"],
|
285 |
+
maximum=space_dict[elem2]["max"],
|
286 |
+
value=space_dict[elem2]["value"],
|
287 |
+
step=space_dict[elem2]["step_display"],
|
288 |
+
)
|
289 |
+
with gr.Row():
|
290 |
+
input_list3 = input_cols.copy()
|
291 |
+
input_list3.remove(elem1)
|
292 |
+
input_list3.remove(elem2)
|
293 |
+
dropdown_3 = gr.Dropdown(label="Fix element 3", choices=input_list3, value=elem3)
|
294 |
+
input_slicer_3 = gr.Slider(
|
295 |
+
label=elem3,
|
296 |
+
minimum=space_dict[elem3]["min"],
|
297 |
+
maximum=space_dict[elem3]["max"],
|
298 |
+
value=space_dict[elem3]["value"],
|
299 |
+
step=space_dict[elem3]["step_display"],
|
300 |
+
)
|
301 |
+
|
302 |
+
with gr.Column():
|
303 |
+
gr.Markdown("### Your design space")
|
304 |
+
output_plot = gr.Plot(type="plotly")
|
305 |
+
|
306 |
with gr.Row():
|
307 |
gr.Examples([example_inputs], [input_formula, input_phase, input_bccfcc, input_processing, input_microstructure])
|
308 |
+
|
309 |
+
input_slicer_1.change(
|
310 |
+
fn=update_plot_fn,
|
311 |
+
inputs=[dropdown_1, input_slicer_1, dropdown_2, input_slicer_2, dropdown_3, input_slicer_3],
|
312 |
+
outputs=[output_plot],
|
313 |
+
show_progress=True,
|
314 |
+
queue=True,
|
315 |
+
every=0.5,
|
316 |
+
)
|
317 |
+
|
318 |
+
input_slicer_2.change(
|
319 |
+
fn=update_plot_fn,
|
320 |
+
inputs=[dropdown_1, input_slicer_1, dropdown_2, input_slicer_2, dropdown_3, input_slicer_3],
|
321 |
+
outputs=[output_plot],
|
322 |
+
show_progress=True,
|
323 |
+
queue=True,
|
324 |
+
# every=2,
|
325 |
+
)
|
326 |
+
|
327 |
+
input_slicer_3.change(
|
328 |
+
fn=update_plot_fn,
|
329 |
+
inputs=[dropdown_1, input_slicer_1, dropdown_2, input_slicer_2, dropdown_3, input_slicer_3],
|
330 |
+
outputs=[output_plot],
|
331 |
+
show_progress=True,
|
332 |
+
queue=True,
|
333 |
+
# every=2,
|
334 |
+
)
|
335 |
+
|
336 |
+
# Update the choices in the dropdown based on the elements selected
|
337 |
+
# dropdown_1.change(fn=update_dropdown, inputs=[dropdown_1], outputs=[dropdown_2, dropdown_3], show_progress=True)
|
338 |
+
# dropdown_2.change(fn=update_dropdown, inputs=[dropdown_2], outputs=[dropdown_1, dropdown_3], show_progress=True)
|
339 |
+
# dropdown_2.change(fn=update_dropdown, inputs=[dropdown_3], outputs=[dropdown_1, dropdown_2], show_progress=True)
|
340 |
+
dropdown_1.change(
|
341 |
+
fn=update_dropdown,
|
342 |
+
inputs=[dropdown_1, dropdown_2, dropdown_3],
|
343 |
+
outputs=[dropdown_1, dropdown_2, dropdown_3],
|
344 |
+
show_progress=True,
|
345 |
+
)
|
346 |
+
dropdown_2.change(
|
347 |
+
fn=update_dropdown,
|
348 |
+
inputs=[dropdown_1, dropdown_2, dropdown_3],
|
349 |
+
outputs=[dropdown_1, dropdown_2, dropdown_3],
|
350 |
+
show_progress=True,
|
351 |
+
)
|
352 |
+
dropdown_3.change(
|
353 |
+
fn=update_dropdown,
|
354 |
+
inputs=[dropdown_1, dropdown_2, dropdown_3],
|
355 |
+
outputs=[dropdown_1, dropdown_2, dropdown_3],
|
356 |
+
show_progress=True,
|
357 |
+
)
|
358 |
+
|
359 |
+
# Update the slider name based on the choice of the dropdow
|
360 |
+
dropdown_1.change(fn=update_slider_fn, inputs=[dropdown_1], outputs=[input_slicer_1])
|
361 |
+
dropdown_2.change(fn=update_slider_fn, inputs=[dropdown_2], outputs=[input_slicer_2])
|
362 |
+
dropdown_3.change(fn=update_slider_fn, inputs=[dropdown_3], outputs=[input_slicer_3])
|
363 |
+
|
364 |
+
|
365 |
train_button.click(
|
366 |
fn=train_model,
|
367 |
inputs=[input_csv, target_columns],
|