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
7a846eee
Commit
7a846eee
authored
Nov 22, 2024
by
zhougaofeng
Browse files
Update ocr_server.py
parent
f34540d6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
magic_pdf/dict2md/ocr_server.py
magic_pdf/dict2md/ocr_server.py
+2
-1
No files found.
magic_pdf/dict2md/ocr_server.py
View file @
7a846eee
...
@@ -57,7 +57,7 @@ def _load_model_processor(args):
...
@@ -57,7 +57,7 @@ def _load_model_processor(args):
else
:
else
:
if
args
.
dcu_id
is
not
None
:
if
args
.
dcu_id
is
not
None
:
device_map
=
{
''
:
f
'cuda:
{
args
.
dcu_id
}
'
}
device_map
=
{
''
:
f
'cuda:
{
args
.
dcu_id
}
'
}
os
.
environ
[
'CUDA_VISIBLE_DEVICES'
]
=
args
.
dcu_id
print
(
'使用DCU推理:'
,
f
'cuda:
{
args
.
dcu_id
}
'
)
print
(
'使用DCU推理:'
,
f
'cuda:
{
args
.
dcu_id
}
'
)
else
:
else
:
device_map
=
'auto'
device_map
=
'auto'
...
@@ -261,6 +261,7 @@ if __name__ == "__main__":
...
@@ -261,6 +261,7 @@ if __name__ == "__main__":
args
=
_get_args
()
args
=
_get_args
()
config
=
configparser
.
ConfigParser
()
config
=
configparser
.
ConfigParser
()
config
.
read
(
args
.
config_path
)
config
.
read
(
args
.
config_path
)
os
.
environ
[
'CUDA_VISIBLE_DEVICES'
]
=
args
.
dcu_id
# host = config.get('server', 'ocr_host')
# host = config.get('server', 'ocr_host')
host
,
port
=
config
.
get
(
'server'
,
'ocr_server'
).
split
(
'://'
)[
1
].
split
(
':'
)[
0
],
int
(
host
,
port
=
config
.
get
(
'server'
,
'ocr_server'
).
split
(
'://'
)[
1
].
split
(
':'
)[
0
],
int
(
config
.
get
(
'server'
,
'ocr_server'
).
split
(
'://'
)[
1
].
split
(
':'
)[
1
])
config
.
get
(
'server'
,
'ocr_server'
).
split
(
'://'
)[
1
].
split
(
':'
)[
1
])
...
...
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