Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
f7694cd8
authored
2020-06-24 10:35:02 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix enqueque
1 parent
79d15292
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
src/apps/doc/management/commands/doc_process.py
src/apps/doc/views.py
src/apps/doc/management/commands/doc_process.py
View file @
f7694cd
...
...
@@ -89,7 +89,6 @@ class Command(BaseCommand, LoggerMixin):
base64_data
=
base64
.
b64encode
(
f
.
read
())
return
{
'imgBase64'
:
base64_data
.
decode
(
'utf-8'
)}
async
def
fetch_ocr_result
(
self
,
img_path
):
async
with
aiohttp
.
ClientSession
(
headers
=
self
.
ocr_header
,
connector
=
aiohttp
.
TCPConnector
(
ssl
=
False
)
...
...
src/apps/doc/views.py
View file @
f7694cd
...
...
@@ -186,12 +186,12 @@ class DocView(GenericView, DocHandler):
data_source
=
random
.
choice
([
'POS'
,
'EAPP'
,
'Econtract'
]),
upload_finish_time
=
timezone
.
now
(),
)
rh
.
enqueue
(
doc
.
id
)
enqueue_res
=
rh
.
enqueue
(
doc
.
id
)
pdf_file
=
args
.
get
(
'pdf_file'
)
save_dir_path
=
os
.
path
.
join
(
conf
.
DATA_DIR
,
str
(
doc
.
id
))
save_file_path
=
os
.
path
.
join
(
save_dir_path
,
'{0}.pdf'
.
format
(
doc
.
id
))
os
.
makedirs
(
save_dir_path
,
exist_ok
=
True
)
file_write
(
pdf_file
,
save_file_path
)
self
.
running_log
.
info
(
'[mock doc upload success] [doc_id={0}]
'
.
format
(
doc
.
id
))
self
.
running_log
.
info
(
'[mock doc upload success] [doc_id={0}]
[enqueue_res={1}]'
.
format
(
doc
.
id
,
enqueue_res
))
return
response
.
ok
()
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment