|
@@ -35,7 +35,8 @@ with app.app_context():
|
|
|
def update_config():
|
|
|
# ------------ 整理参数,整合请求参数 ------------
|
|
|
args_dict = request.values.to_dict()
|
|
|
- args_dict['features'] = args_dict['features'].split(',')
|
|
|
+ if 'features' in args_dict:
|
|
|
+ args_dict['features'] = args_dict['features'].split(',')
|
|
|
args.update(args_dict)
|
|
|
opt = argparse.Namespace(**args)
|
|
|
dh.opt = opt
|
|
@@ -58,7 +59,7 @@ def model_prediction_bp():
|
|
|
feature_scaler, target_scaler = get_scaler_model_from_mongo(args)
|
|
|
ts.opt.cap = round(target_scaler.transform(np.array([[float(args['cap'])]]))[0, 0], 2)
|
|
|
ts.get_model(args)
|
|
|
- dh.opt.features = json.loads(ts.model_params).get('features', args['features'])
|
|
|
+ dh.opt.features = json.loads(ts.model_params).get('features', ts.opt.features)
|
|
|
scaled_pre_x, pre_data = dh.pre_data_handler(pre_data, feature_scaler)
|
|
|
res = list(chain.from_iterable(target_scaler.inverse_transform(ts.predict(scaled_pre_x))))
|
|
|
pre_data['farm_id'] = args.get('farm_id', 'null')
|