Skip to content

Commit

Permalink
testing pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
vahidrezanezhad committed Aug 14, 2024
1 parent 00bf2b6 commit e976778
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 66 deletions.
30 changes: 30 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "eynollah"
version = "1.2.3"




dependencies = [
"ocrd >= 2.23.3",
"tensorflow >= 2.12.0",
"scikit-learn >= 0.23.2",
"imutils >= 0.5.3",
"numpy < 1.24.0",
"matplotlib",
"torch == 2.0.1",
"transformers == 4.30.2",
"numba == 0.58.1",
]

[project.scripts]
eynollah = "qurator.eynollah.cli:main"


[tool.setuptools.packages.find]
where = ["."]
include = ["qurator"]
80 changes: 50 additions & 30 deletions qurator/eynollah/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,60 @@
from ocrd_utils import initLogging, setOverrideLogLevel
from qurator.eynollah.eynollah import Eynollah

@click.group()
def main():
pass

@click.command()
@main.command()
@click.option(
"--dir_xml",
"-dx",
help="directory of GT page-xml files",
type=click.Path(exists=True, file_okay=False),
)

@click.option(
"--dir_out_modal_image",
"-domi",
help="directory where ground truth images would be written",
type=click.Path(exists=True, file_okay=False),
)

@click.option(
"--dir_out_classes",
"-docl",
help="directory where ground truth classes would be written",
type=click.Path(exists=True, file_okay=False),
)

@click.option(
"--input_height",
"-ih",
help="input height",
)
@click.option(
"--input_width",
"-iw",
help="input width",
)
@click.option(
"--min_area_size",
"-min",
help="min area size of regions considered for reading order training.",
)

def machine_based_reading_order(dir_xml, dir_out_modal_image, dir_out_classes, input_height, input_width, min_area_size):
xml_files_ind = os.listdir(dir_xml)


@main.command()
@click.option(
"--image",
"-i",
help="image filename",
type=click.Path(exists=True, dir_okay=False),
)

@click.option(
"--out",
"-o",
Expand Down Expand Up @@ -146,37 +192,13 @@
help="if this parameter set to true, this tool will try to do ocr",
)
@click.option(
"--log-level",
"--log_level",
"-l",
type=click.Choice(['OFF', 'DEBUG', 'INFO', 'WARN', 'ERROR']),
help="Override log level globally to this",
)
def main(
image,
out,
dir_in,
model,
save_images,
save_layout,
save_deskewed,
save_all,
save_page,
enable_plotting,
allow_enhancement,
curved_line,
textline_light,
full_layout,
tables,
right2left,
input_binary,
allow_scaling,
headers_off,
light_version,
reading_order_machine_based,
do_ocr,
ignore_page_extraction,
log_level
):

def layout(image, out, dir_in, model, save_images, save_layout, save_deskewed, save_all, save_page, enable_plotting, allow_enhancement, curved_line, textline_light, full_layout, tables, right2left, input_binary, allow_scaling, headers_off, light_version, reading_order_machine_based, do_ocr, ignore_page_extraction, log_level):
if log_level:
setOverrideLogLevel(log_level)
initLogging()
Expand Down Expand Up @@ -215,8 +237,6 @@ def main(
do_ocr=do_ocr,
)
eynollah.run()
#pcgts = eynollah.run()
##eynollah.writer.write_pagexml(pcgts)

if __name__ == "__main__":
main()
8 changes: 0 additions & 8 deletions requirements.txt

This file was deleted.

28 changes: 0 additions & 28 deletions setup.py

This file was deleted.

0 comments on commit e976778

Please sign in to comment.