Commit de473695 by lichenggang

format

parent 10487e07
......@@ -17,7 +17,6 @@ class BaseHandler(tornado.web.RequestHandler):
super().__init__(*args, **kwargs)
self.predictorfac = PredictorFac(model_config)
class KwHandler(BaseHandler):
async def get(self):
try:
......@@ -30,7 +29,7 @@ class KwHandler(BaseHandler):
'status': 0,
'err_msg': '未知'
}
bom_log.error(f'http关键词报错: \n' + traceback.format_exc())
bom_log.error(f'http关键词识别报错: \n' + traceback.format_exc())
self.write(res)
......@@ -44,12 +43,12 @@ class DictHandler(BaseHandler):
if '数量' not in str(res):
res = {
'status': 0,
'err_msg': f'未识别到数量列'
'err_msg': '未识别到数量列'
}
if '参数' not in str(res) and '型号' not in str(res):
res = {
'status': 0,
'err_msg': f'未识别到参数列'
'err_msg': '未识别到参数列'
}
except json.decoder.JSONDecodeError:
......@@ -60,7 +59,7 @@ class DictHandler(BaseHandler):
'status': 0,
'err_msg': '未知'
}
bom_log.error(f'http字典报错: \n' + traceback.format_exc())
bom_log.error(f'http字典识别报错: \n' + traceback.format_exc())
self.write(res)
......
......@@ -178,7 +178,7 @@ class DicPredict(BasePredictor):
if comprehensive_res:
res = {
'std_result': comprehensive_res,
'ab_result': head_id_res['ab_result'],
'ab_result': head_id_res['ab_result'] or model_id_res['ab_result'] or {},
}
return res
......
......@@ -37,3 +37,13 @@ CATEGORY = ["半导体", "嵌入式", "光电子", "光源", "无源", "连接
"分线盒", "变送器", "调制与控制", "气动", "螺线管", "启动器", "阀门和汇流板", "空气设备", "仪表", "气动配件", "测量", "软焊和焊接设备", "PCB原型制作与生产",
"化学制剂", "工具", "防静电保护", "健康与安全", "收音机和CB用框架及半框架", "扬声器罩,前面板固定座", "排线", "电机控制模块", "微型电动机", "底板", "3D打印机",
"RTV服务", "配件", "三极管", '钽电容', 'MOS管', '芯片', '器件', '模组', '接线', '按键', 'IC', 'LDO']
# 冲突时识别优先级,暂时没用
DIC_PRIORITY = {
'参数': 10,
'型号': 9,
'品牌': 8,
'数量': 7,
'序号': 6,
'其他': 5
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment