snajmark commited on
Commit
e4d4d36
·
1 Parent(s): 69cafe9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -136,8 +136,8 @@ def predict_from_tuple(in1, in2, in3, in4, in5, request: gr.Request):
136
  print("One hot columns are ", one_hot.columns)
137
  return predict(one_hot, request)
138
 
139
- def fit_outputs_constraints(x, hardness_target, ys_target):
140
- predictions = predict(x)
141
  error_hardness = np.sqrt(np.square(predictions[0]-hardness_target))
142
  error_ys = np.sqrt(np.square(predictions[2]-ys_target))
143
  print(predictions, hardness_target, ys_target, error_hardness, error_ys)
@@ -176,7 +176,7 @@ def predict_inverse(hardness_target, ys_target, request: gr.Request):
176
  constraints.append({'name': constraint + "-1", 'constraint': '-1*(' + sum_string + ')+1'})
177
 
178
  def fit_outputs(x):
179
- return fit_outputs_constraints(x, hardness_target, ys_target)
180
 
181
  opt = GPyOpt.methods.BayesianOptimization(f = fit_outputs, # function to optimize
182
  domain = domain, # box-constraints of the problem
 
136
  print("One hot columns are ", one_hot.columns)
137
  return predict(one_hot, request)
138
 
139
+ def fit_outputs_constraints(x, hardness_target, ys_target, request: gr.Request):
140
+ predictions = predict(x, request)
141
  error_hardness = np.sqrt(np.square(predictions[0]-hardness_target))
142
  error_ys = np.sqrt(np.square(predictions[2]-ys_target))
143
  print(predictions, hardness_target, ys_target, error_hardness, error_ys)
 
176
  constraints.append({'name': constraint + "-1", 'constraint': '-1*(' + sum_string + ')+1'})
177
 
178
  def fit_outputs(x):
179
+ return fit_outputs_constraints(x, hardness_target, ys_target, request)
180
 
181
  opt = GPyOpt.methods.BayesianOptimization(f = fit_outputs, # function to optimize
182
  domain = domain, # box-constraints of the problem