Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zhougaofeng
magic_pdf
Commits
3b30e749
Commit
3b30e749
authored
Oct 23, 2024
by
zhougaofeng
Browse files
Update pdf_client.py
parent
46988c37
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
magic_pdf/parse/pdf_client.py
magic_pdf/parse/pdf_client.py
+5
-2
No files found.
magic_pdf/parse/pdf_client.py
View file @
3b30e749
...
@@ -25,9 +25,11 @@ class ocrPdfClient:
...
@@ -25,9 +25,11 @@ class ocrPdfClient:
)
)
try
:
try
:
response
=
requests
.
post
(
f
"
{
self
.
api_url
}
/pdf_ocr"
,
json
=
payload
)
response
=
requests
.
post
(
f
"
{
self
.
api_url
}
/pdf_ocr"
,
json
=
payload
)
#logger.info(f'response:{response.json()}')
output_dir
=
response
.
json
()[
'output_path'
]
response
.
raise_for_status
()
response
.
raise_for_status
()
output_dir
=
os
.
path
.
join
(
output_dir
,
file_name_without_extension
)
#logger.info(f'output_dir:{output_dir}'
)
return
output_dir
if
response
.
status_code
==
200
else
None
return
output_dir
if
response
.
json
()[
'
status_code
'
]
==
200
else
None
except
requests
.
exceptions
.
RequestException
as
e
:
except
requests
.
exceptions
.
RequestException
as
e
:
logger
.
error
(
f
"OCR PDF API request failed:
{
e
}
"
)
logger
.
error
(
f
"OCR PDF API request failed:
{
e
}
"
)
return
None
return
None
...
@@ -87,3 +89,4 @@ def main():
...
@@ -87,3 +89,4 @@ def main():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
main
()
main
()
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