mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-04-30 19:22:03 +02:00
organize ocrd-eynollah-segment like ocrd-sbb-binarize
This commit is contained in:
parent
bb092364af
commit
957dc66e7c
3 changed files with 14 additions and 17 deletions
|
|
@ -41,7 +41,7 @@ classifiers = [
|
|||
[project.scripts]
|
||||
eynollah = "eynollah.cli:main"
|
||||
eynollah-training = "eynollah.training.cli:main"
|
||||
ocrd-eynollah-segment = "eynollah.ocrd_cli:main"
|
||||
ocrd-eynollah-segment = "eynollah.ocrd_cli_segment:main"
|
||||
ocrd-sbb-binarize = "eynollah.ocrd_cli_binarization:main"
|
||||
|
||||
[project.urls]
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
# NOTE: For predictable order of imports of torch/shapely/tensorflow
|
||||
# this must be the first import of the CLI!
|
||||
from .eynollah_imports import imported_libs
|
||||
from .processor import EynollahProcessor
|
||||
from click import command
|
||||
from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor
|
||||
|
||||
@command()
|
||||
@ocrd_cli_options
|
||||
def main(*args, **kwargs):
|
||||
return ocrd_cli_wrap_processor(EynollahProcessor, *args, **kwargs)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
# NOTE: For predictable order of imports of torch/shapely/tensorflow
|
||||
# this must be the first import of the CLI!
|
||||
from .eynollah_imports import imported_libs
|
||||
from click import command
|
||||
from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor
|
||||
|
||||
from functools import cached_property
|
||||
from typing import Optional
|
||||
from ocrd_models import OcrdPage
|
||||
|
|
@ -5,9 +11,9 @@ from ocrd import OcrdPageResultImage, Processor, OcrdPageResult
|
|||
|
||||
from eynollah.model_zoo.model_zoo import EynollahModelZoo
|
||||
|
||||
from .eynollah import Eynollah, EynollahXmlWriter
|
||||
from .eynollah import Eynollah
|
||||
|
||||
class EynollahProcessor(Processor):
|
||||
class EynollahSegmentProcessor(Processor):
|
||||
@cached_property
|
||||
def executable(self) -> str:
|
||||
return 'ocrd-eynollah-segment'
|
||||
|
|
@ -81,3 +87,8 @@ class EynollahProcessor(Processor):
|
|||
# ocrd.Processor will handle OCRD_EXISTING_OUTPUT more flexibly
|
||||
overwrite=True)
|
||||
return result
|
||||
|
||||
@command()
|
||||
@ocrd_cli_options
|
||||
def main(*args, **kwargs):
|
||||
return ocrd_cli_wrap_processor(EynollahSegmentProcessor, *args, **kwargs)
|
||||
Loading…
Add table
Add a link
Reference in a new issue