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
884e0815
authored
Jun 03, 2020
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加日志
parent
d861280f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
classify_server.py
predict/dict_predict.py
classify_server.py
View file @
884e0815
...
...
@@ -3,7 +3,7 @@ import time, json
import
grpc
from
protobuf
import
classify_pb2
from
protobuf
import
classify_pb2_grpc
import
traceback
from
utils.config
import
model_config
from
predic_fac
import
PredictorFac
from
utils.log_manager
import
get_logger
...
...
@@ -18,9 +18,17 @@ class Classify(classify_pb2_grpc.classifyServicer):
def
Classify
(
self
,
request
,
context
):
dic_data
=
json
.
loads
(
request
.
keyword
)
print
(
dic_data
)
res
=
self
.
predictorfac
.
predict
(
dic_data
)
try
:
dic_data
=
json
.
loads
(
request
.
keyword
)
res
=
self
.
predictorfac
.
predict
(
dic_data
)
res
[
'status'
]
=
1
except
:
res
=
{
'status'
:
0
,
'err_msg'
:
'未知'
}
log_server
.
error
(
traceback
.
format_exc
())
return
classify_pb2
.
ClassifyReply
(
message
=
'result {msg}'
.
format
(
msg
=
res
))
def
fac_test_predic
(
self
,
data
):
...
...
predict/dict_predict.py
View file @
884e0815
...
...
@@ -138,13 +138,14 @@ class DicPredict(BasePredictor):
return
model_id_res
def
predict
(
self
,
dic_data
,
predict_type
=
'all'
):
self
.
info
.
info
(
'预测类型为
%
s接收数据: '
%
predict_type
+
str
(
dic_data
))
dic_data
=
self
.
pre_deal
(
dic_data
)
if
predict_type
==
'all'
:
head_id_res
=
self
.
head_predict
(
dic_data
)
model_id_res
=
self
.
model_predict
(
dic_data
)
print
(
'表头预测结果'
,
head_id_res
)
print
(
'模型预测结果'
,
model_id_res
)
self
.
info
.
info
(
'表头预测结果: '
+
str
(
head_id_res
)
)
self
.
info
.
info
(
'模型预测结果: '
+
str
(
model_id_res
)
)
# 表头预测和模型预测最后返回的数据进行综合处理
head_std_result
=
head_id_res
.
get
(
'std_result'
)
...
...
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