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
79304ec4
authored
Jun 05, 2020
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加未识别到参数或数量的情况
parent
adb6842f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletions
classify_server.py
http_server.py
predict/base_handler.py
classify_server.py
View file @
79304ec4
...
...
@@ -21,6 +21,13 @@ class Classify(classify_pb2_grpc.classifyServicer):
dic_data
=
json
.
loads
(
request
.
keyword
)
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}列'
}
except
json
.
decoder
.
JSONDecodeError
:
res
=
self
.
predictorfac
.
predict
(
request
.
keyword
)
res
[
'status'
]
=
1
...
...
http_server.py
View file @
79304ec4
...
...
@@ -41,6 +41,14 @@ 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}列'
}
except
json
.
decoder
.
JSONDecodeError
:
res
=
self
.
predictorfac
.
predict
(
self
.
request
.
body
)
res
[
'status'
]
=
1
...
...
predict/base_handler.py
View file @
79304ec4
...
...
@@ -165,4 +165,4 @@ class BasePredictor:
if
__name__
==
"__main__"
:
p
ass
p
rint
(
BasePredictor
.
is_num
([
100
,
200
]))
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