Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default thread number from 4 to number of CPUs available #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ Fine-tuning Tesseract/Ghostscript/others

You can specify Tesseract and Ghostscript executable locations manually, as
well as the number of concurrent processes allowed during preprocessing and
tesseract. Use the following in your configuration file:
tesseract. Defaults to the number of CPUs available. Use the following in
your configuration file:

::

Expand Down
2 changes: 1 addition & 1 deletion pypdfocr/pypdfocr_gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, config):
'GS_OUTDATED': 'Your Ghostscript version is probably out of date. Please upgrade to the latest version',
'GS_MISSING_BINARY': 'Could not find Ghostscript in the usual place; please specify it using your config file',
}
self.threads = config.get('threads',4)
self.threads = config.get('threads', os.cpu_count())

if "binary" in config: # Override location of binary
binary = config['binary']
Expand Down
2 changes: 1 addition & 1 deletion pypdfocr/pypdfocr_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, config):
self.msgs = {
'CV_FAILED': 'convert execution failed',
}
self.threads = config.get('threads', 4)
self.threads = config.get('threads', os.cpu_count())

def _warn(self, msg): # pragma: no cover
print("WARNING: %s" % msg)
Expand Down
2 changes: 1 addition & 1 deletion pypdfocr/pypdfocr_tesseract.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, config):
"""
self.lang = 'eng'
self.required = "3.02.02"
self.threads = config.get('threads',4)
self.threads = config.get('threads', os.cpu_count())

if "binary" in config: # Override location of binary
binary = config['binary']
Expand Down