Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -144,7 +144,7 @@ def fit_outputs_constraints(x, hardness_target, ys_target, request: gr.Request):
|
|
144 |
error_hardness, error_ys)
|
145 |
return error_hardness + error_ys
|
146 |
|
147 |
-
def predict_inverse(hardness_target, ys_target, request: gr.Request):
|
148 |
|
149 |
one_hot_columns = utils.return_feature_names()
|
150 |
|
@@ -154,16 +154,25 @@ def predict_inverse(hardness_target, ys_target, request: gr.Request):
|
|
154 |
for c in continuous_variables:
|
155 |
categorical_variables.remove(c)
|
156 |
|
|
|
|
|
|
|
|
|
157 |
domain = []
|
158 |
for c in one_hot_columns:
|
159 |
if c in continuous_variables:
|
160 |
if c == continuous_variables[0]:
|
161 |
-
|
|
|
|
|
162 |
else:
|
163 |
-
|
|
|
|
|
164 |
else:
|
165 |
domain.append({'name': str(c), 'type': 'discrete', 'domain': (0,1)})
|
166 |
|
|
|
167 |
constraints = []
|
168 |
constrained_columns = ['Single/Multiphase', 'Preprocessing method', 'BCC/FCC/other']#, 'Microstructure']
|
169 |
|
|
|
144 |
error_hardness, error_ys)
|
145 |
return error_hardness + error_ys
|
146 |
|
147 |
+
def predict_inverse(hardness_target, ys_target, formula, request: gr.Request):
|
148 |
|
149 |
one_hot_columns = utils.return_feature_names()
|
150 |
|
|
|
154 |
for c in continuous_variables:
|
155 |
categorical_variables.remove(c)
|
156 |
|
157 |
+
|
158 |
+
fixed_density = utils.calculate_density(str(formula))
|
159 |
+
fixed_ym = utils.calculate_youngs_modulus(str(formula))
|
160 |
+
|
161 |
domain = []
|
162 |
for c in one_hot_columns:
|
163 |
if c in continuous_variables:
|
164 |
if c == continuous_variables[0]:
|
165 |
+
domain_density = (fixed_density-scaling_factors[c][0])/(
|
166 |
+
scaling_factors[c][1]-scaling_factors[c][0])
|
167 |
+
domain.append({'name': str(c), 'type': 'continuous', 'domain': (domain_density)})#(0.,1.)})
|
168 |
else:
|
169 |
+
domain_ym = (fixed_ym-scaling_factors[c][0])/(
|
170 |
+
scaling_factors[c][1]-scaling_factors[c][0])
|
171 |
+
domain.append({'name': str(c), 'type': 'continuous', 'domain': (domain_ym)})#(0.,1.)})
|
172 |
else:
|
173 |
domain.append({'name': str(c), 'type': 'discrete', 'domain': (0,1)})
|
174 |
|
175 |
+
print("Domain is ", domain)
|
176 |
constraints = []
|
177 |
constrained_columns = ['Single/Multiphase', 'Preprocessing method', 'BCC/FCC/other']#, 'Microstructure']
|
178 |
|