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
0d5d0364
authored
Jun 05, 2020
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
未识别到参数或数量列先这么写着
parent
79304ec4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
classify_server.py
http_server.py
classify_server.py
View file @
0d5d0364
...
...
@@ -22,12 +22,17 @@ class Classify(classify_pb2_grpc.classifyServicer):
res
=
self
.
predictorfac
.
predict
(
dic_data
)
res
[
'status'
]
=
1
for
i
in
[
'参数'
,
'数量'
]:
if
i
not
in
str
(
res
):
res
=
{
'status'
:
0
,
'err_msg'
:
f
'未识别到{i}列'
}
if
'数量'
not
in
str
(
res
):
res
=
{
'status'
:
0
,
'err_msg'
:
f
'未识别到数量列'
}
if
'参数'
not
in
str
(
res
):
res
=
{
'status'
:
0
,
'err_msg'
:
f
'未识别到参数列'
}
except
json
.
decoder
.
JSONDecodeError
:
res
=
self
.
predictorfac
.
predict
(
request
.
keyword
)
res
[
'status'
]
=
1
...
...
http_server.py
View file @
0d5d0364
...
...
@@ -41,13 +41,16 @@ class DictHandler(BaseHandler):
dic_data
=
json
.
loads
(
self
.
request
.
body
)
res
=
self
.
predictorfac
.
predict
(
dic_data
)
res
[
'status'
]
=
1
for
i
in
[
'参数'
,
'数量'
]:
if
i
not
in
str
(
res
):
res
=
{
'status'
:
0
,
'err_msg'
:
f
'未识别到{i}列'
}
if
'数量'
not
in
str
(
res
):
res
=
{
'status'
:
0
,
'err_msg'
:
f
'未识别到数量列'
}
if
'参数'
not
in
str
(
res
):
res
=
{
'status'
:
0
,
'err_msg'
:
f
'未识别到参数列'
}
except
json
.
decoder
.
JSONDecodeError
:
res
=
self
.
predictorfac
.
predict
(
self
.
request
.
body
)
...
...
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