add OCR-D click interface

pull/5/head
Konstantin Baierer 4 years ago
parent 6913415f55
commit d4c97ebf72

@ -4,15 +4,17 @@ import os.path
from pkg_resources import resource_string
from json import loads
from click import command
from ocrd_utils import (
getLogger,
assert_file_grp_cardinality,
make_file_id,
MIMETYPE_PAGE
)
from ocrd import Processor
from ocrd_modelfactory import page_from_file
from ocrd_models.ocrd_page import AlternativeImageType, to_xml
from ocrd import Processor
from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor
from .sbb_binarize import SbbBinarizer
@ -113,3 +115,8 @@ class SbbBinarizeProcessor(Processor):
mimetype=MIMETYPE_PAGE,
local_filename=os.path.join(self.output_file_grp, file_id + '.xml'),
content=to_xml(pcgts))
@command()
@ocrd_cli_options
def cli(*args, **kwargs):
return ocrd_cli_wrap_processor(SbbBinarizeProcessor, *args, **kwargs)

@ -23,6 +23,7 @@ setup(
entry_points={
'console_scripts': [
'sbb_binarize=sbb_binarize.cli:main',
'ocrd-sbb-binarize=sbb_binarize.ocrd_cli:cli',
]
},
)

Loading…
Cancel
Save