Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -166,10 +166,11 @@ def predict_inverse(hardness_target, ys_target, request: gr.Request):
|
|
166 |
|
167 |
constraints = []
|
168 |
constrained_columns = ['Single/Multiphase', 'Preprocessing method', 'BCC/FCC/other']#, 'Microstructure']
|
|
|
169 |
for constraint in constrained_columns:
|
170 |
sum_string = ''
|
171 |
-
for i in range (len(
|
172 |
-
column_one_hot =
|
173 |
if column_one_hot.startswith(constraint):
|
174 |
sum_string = sum_string+"+x[:," + str(i) + "]"
|
175 |
constraints.append({'name': constraint + "+1", 'constraint': sum_string + '-1'})
|
@@ -245,25 +246,6 @@ with gr.Blocks(css=css_styling, title=page_title, theme=osium_theme) as demo:
|
|
245 |
input_yield_strength = gr.Text(label="Enter your target yield strength (MPa)")
|
246 |
with gr.Column():
|
247 |
gr.Markdown("### Your optimal formulation and processing conditions")
|
248 |
-
output_formula = gr.Textbox(
|
249 |
-
lines=1, label=input_cols["PROPERTY: Alloy formula"]
|
250 |
-
)
|
251 |
-
output_phase = gr.Dropdown(
|
252 |
-
choices=list(input_mapping["PROPERTY: Single/Multiphase"].keys()),
|
253 |
-
label=input_cols["PROPERTY: Single/Multiphase"],
|
254 |
-
)
|
255 |
-
output_bccfcc = gr.Dropdown(
|
256 |
-
choices=list(input_mapping["PROPERTY: BCC/FCC/other"].keys()),
|
257 |
-
label=input_cols["PROPERTY: BCC/FCC/other"],
|
258 |
-
)
|
259 |
-
output_processing = gr.Dropdown(
|
260 |
-
choices=list(input_mapping["PROPERTY: Processing method"].keys()),
|
261 |
-
label=input_cols["PROPERTY: Processing method"],
|
262 |
-
)
|
263 |
-
output_microstructure = gr.CheckboxGroup(
|
264 |
-
choices=unique_phase_elements, #list(input_mapping["PROPERTY: Microstructure"].keys()),
|
265 |
-
label=input_cols["PROPERTY: Microstructure"],
|
266 |
-
)
|
267 |
optimal_parameters = gr.DataFrame(label="Optimal parameters")
|
268 |
|
269 |
# with gr.Column():
|
|
|
166 |
|
167 |
constraints = []
|
168 |
constrained_columns = ['Single/Multiphase', 'Preprocessing method', 'BCC/FCC/other']#, 'Microstructure']
|
169 |
+
one_hot_colums = utils.return_feature_names()
|
170 |
for constraint in constrained_columns:
|
171 |
sum_string = ''
|
172 |
+
for i in range (len(one_hot_columns)):
|
173 |
+
column_one_hot = one_hot_columns[i]
|
174 |
if column_one_hot.startswith(constraint):
|
175 |
sum_string = sum_string+"+x[:," + str(i) + "]"
|
176 |
constraints.append({'name': constraint + "+1", 'constraint': sum_string + '-1'})
|
|
|
246 |
input_yield_strength = gr.Text(label="Enter your target yield strength (MPa)")
|
247 |
with gr.Column():
|
248 |
gr.Markdown("### Your optimal formulation and processing conditions")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
optimal_parameters = gr.DataFrame(label="Optimal parameters")
|
250 |
|
251 |
# with gr.Column():
|