snajmark commited on
Commit
7c032b4
·
1 Parent(s): 34db25a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -20
app.py CHANGED
@@ -188,7 +188,7 @@ def predict_inverse(hardness_original_target, ys_original_target, metals_to_use,
188
  result[column]/= sum_metals
189
  result[column] = round(result[column], 2)
190
 
191
- return result
192
 
193
 
194
  example_inputs = [820, 1800]
@@ -240,33 +240,25 @@ with gr.Blocks(css=css_styling, title=page_title, theme=osium_theme) as demo:
240
  )
241
  with gr.Column():
242
  with gr.Row():
243
- #with gr.Column():
244
- # gr.Markdown("### Your optimal alloy formula and processing conditions")
245
- optimal_parameters = gr.DataFrame(label="Optimal parameters", wrap=True)
246
- #with gr.Column():
247
- # param1 = gr.Text(label="Processing method")
248
- #with gr.Column():
249
- # param2 = gr.Text(label="Microstructure")
250
- #with gr.Column():
251
- # param3 = gr.Text(label="Phase")
252
- #with gr.Row():
253
- #with gr.Column():
254
- #with gr.Row():
255
- # gr.Markdown("### Interpretation of hardness prediction")
256
- # gr.Markdown("### Interpretation of yield strength prediction")
257
- #with gr.Row():
258
- # output_interpretation = gr.Plot(label="Interpretation")
259
 
260
  with gr.Row():
261
- gr.Examples([example_inputs], [input_hardness, input_yield_strength])
262
 
263
 
264
 
265
  prediction_button.click(
266
  fn=predict_inverse,
267
  inputs=[input_hardness, input_yield_strength, metals_constraints],
268
- outputs=[optimal_parameters
269
- ],
270
  show_progress=True,
271
  )
272
  clear_button.click(
 
188
  result[column]/= sum_metals
189
  result[column] = round(result[column], 2)
190
 
191
+ return result[:-3], result[-3], result[0], result[1], result[-2], result[-1]
192
 
193
 
194
  example_inputs = [820, 1800]
 
240
  )
241
  with gr.Column():
242
  with gr.Row():
243
+ with gr.Column():
244
+ gr.Markdown("### Your optimal alloy formula and processing conditions")
245
+ optimal_formula = gr.DataFrame(label="Your optimal alloy formula", wrap=True)
246
+ optimal_processing_method = gr.Text(label="Processing method")
247
+ gr.Markdown("### Additional information about your optimal alloy")
248
+ density = gr.Text(label="Density (g/cm3)")
249
+ young_modulus = gr.Text(label = "Young modulus (GPa)")
250
+ microstructure = gr.Text(label="Microstructure (BCC/FCC/Other)")
251
+ phase = gr.Text(label="Number of phases (S/M)")
 
 
 
 
 
 
 
252
 
253
  with gr.Row():
254
+ gr.Examples([example_inputs], [input_hardness, input_yield_strength, ['Al', 'Fe']])
255
 
256
 
257
 
258
  prediction_button.click(
259
  fn=predict_inverse,
260
  inputs=[input_hardness, input_yield_strength, metals_constraints],
261
+ outputs=[optimal_formula, optimal_processing_method, density, young_modulus, microstructure, phase],
 
262
  show_progress=True,
263
  )
264
  clear_button.click(