Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
bom_identify
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
de473695
authored
Jun 09, 2020
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
format
parent
10487e07
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
http_server.py
predict/dict_predict.py
static_config.py
http_server.py
View file @
de473695
...
...
@@ -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
)
...
...
predict/dict_predict.py
View file @
de473695
...
...
@@ -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
...
...
static_config.py
View file @
de473695
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment