|
@@ -12,7 +12,7 @@ from common.database_dml import *
|
|
|
from common.processing_data_common import missing_features, str_to_list
|
|
|
from data_processing.data_operation.data_handler import DataHandler
|
|
|
from threading import Lock
|
|
|
-import time, yaml
|
|
|
+import time, yaml, os
|
|
|
model_lock = Lock()
|
|
|
from itertools import chain
|
|
|
from common.logs import Log
|
|
@@ -24,7 +24,8 @@ np.random.seed(42) # NumPy随机种子
|
|
|
app = Flask('tf_cnn_pre——service')
|
|
|
|
|
|
with app.app_context():
|
|
|
- with open('./models_processing/model_koi/bp.yaml', 'r', encoding='utf-8') as f:
|
|
|
+ current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
+ with open(os.path.join(current_dir, 'cnn.yaml'), 'r', encoding='utf-8') as f:
|
|
|
args = yaml.safe_load(f)
|
|
|
|
|
|
dh = DataHandler(logger, args)
|
|
@@ -73,7 +74,7 @@ def model_prediction_bp():
|
|
|
pre_data = pre_data[res_cols]
|
|
|
|
|
|
pre_data['power_forecast'] = pre_data['power_forecast'].round(2)
|
|
|
- pre_data.loc[pre_data['power_forecast'] > g.opt.cap, 'power_forecast'] = g.opt.cap
|
|
|
+ pre_data.loc[pre_data['power_forecast'] > args['cap'], 'power_forecast'] = args['cap']
|
|
|
pre_data.loc[pre_data['power_forecast'] < 0, 'power_forecast'] = 0
|
|
|
|
|
|
insert_data_into_mongo(pre_data, args)
|