模型接口异常检查

This commit is contained in:
王思川 2021-12-15 10:54:10 +08:00
parent 878703333d
commit 33584c3c53
2 changed files with 8 additions and 5 deletions

View File

@ -158,7 +158,7 @@ class RatingModel:
result['评价年度'] = self.period
result['评价方式'] = '企业申报'
result['评价时间'] = time.strftime("%Y-%m-%d", time.localtime())
result['信用评分'] = benchmark - self.risk_score['经营风险']['合计'] - self.risk_score['关联风险']['合计']
result['信用评分'] = round(benchmark - self.risk_score['经营风险']['合计'] - self.risk_score['关联风险']['合计'], 2)
result['信用等级'] = self.score_rank(result['信用评分'])
result['经营评分'] = self.operating_score
result['财务评分'] = self.financial_score

View File

@ -10,7 +10,10 @@ rating_route = Blueprint('rating', __name__)
@verify_token
def general_model():
input_data = request.json['input_data']
try:
model = RatingModel(input_data)
model.save_indicators()
model.save_result()
return {"info": "模型执行成功"}, 200
except Exception:
return {"info": "模型执行失败"}, 210