From 75af55dbdae28db7c2585b2cdc321f5f02e9e1fb Mon Sep 17 00:00:00 2001 From: Julius Unverfehrt Date: Fri, 9 Feb 2024 08:17:09 +0100 Subject: [PATCH] chore(project structure): use src/ structure --- Dockerfile | 11 ++--- Dockerfile_tests | 5 ++- config.yaml | 24 ----------- image_prediction/config.py | 6 --- image_prediction/locations.py | 16 ------- poetry.lock | 42 ++++++++++--------- pyproject.toml | 4 +- .../image_prediction}/__init__.py | 0 .../image_prediction}/classifier/__init__.py | 0 .../classifier/classifier.py | 0 .../classifier/image_classifier.py | 0 .../image_prediction}/compositor/__init__.py | 0 .../compositor/compositor.py | 0 src/image_prediction/config.py | 7 ++++ .../image_prediction}/default_objects.py | 0 .../image_prediction}/encoder/__init__.py | 0 .../image_prediction}/encoder/encoder.py | 0 .../encoder/encoders/__init__.py | 0 .../encoder/encoders/hash_encoder.py | 0 .../image_prediction}/estimator/__init__.py | 0 .../estimator/adapter/__init__.py | 0 .../estimator/adapter/adapter.py | 0 .../estimator/adapter/adapters/__init__.py | 0 .../estimator/preprocessor/__init__.py | 0 .../estimator/preprocessor/preprocessor.py | 0 .../preprocessor/preprocessors/__init__.py | 0 .../preprocessor/preprocessors/basic.py | 0 .../preprocessor/preprocessors/identity.py | 0 .../estimator/preprocessor/utils.py | 0 .../image_prediction}/exceptions.py | 0 .../image_prediction}/extraction.py | 0 .../image_prediction}/flask.py | 0 .../image_prediction}/formatter/__init__.py | 0 .../image_prediction}/formatter/formatter.py | 0 .../formatter/formatters/__init__.py | 0 .../formatter/formatters/camel_case.py | 0 .../formatter/formatters/enum.py | 0 .../formatter/formatters/identity.py | 0 .../formatter/formatters/key_formatter.py | 0 .../image_extractor/__init__.py | 0 .../image_extractor/extractor.py | 0 .../image_extractor/extractors/__init__.py | 0 .../image_extractor/extractors/mock.py | 0 .../image_extractor/extractors/parsable.py | 0 .../image_prediction}/info.py | 0 .../label_mapper/__init__.py | 0 .../image_prediction}/label_mapper/mapper.py | 0 .../label_mapper/mappers/__init__.py | 0 .../label_mapper/mappers/numeric.py | 0 .../label_mapper/mappers/probability.py | 0 src/image_prediction/locations.py | 18 ++++++++ .../model_loader/__init__.py | 0 .../model_loader/database/__init__.py | 0 .../model_loader/database/connector.py | 0 .../database/connectors/__init__.py | 0 .../model_loader/database/connectors/mock.py | 0 .../image_prediction}/model_loader/loader.py | 0 .../model_loader/loaders/__init__.py | 0 .../model_loader/loaders/mlflow.py | 0 .../image_prediction}/pipeline.py | 0 .../redai_adapter/__init__.py | 0 .../redai_adapter/efficient_net_wrapper.py | 0 .../image_prediction}/redai_adapter/mlflow.py | 0 .../image_prediction}/redai_adapter/model.py | 0 .../redai_adapter/model_wrapper.py | 0 .../image_prediction}/stitching/__init__.py | 0 .../image_prediction}/stitching/grouping.py | 0 .../image_prediction}/stitching/merging.py | 0 .../stitching/split_mapper.py | 0 .../image_prediction}/stitching/stitching.py | 0 .../image_prediction}/stitching/utils.py | 0 .../image_prediction}/transformer/__init__.py | 0 .../transformer/transformer.py | 0 .../transformer/transformers/__init__.py | 0 .../transformers/coordinate/__init__.py | 0 .../coordinate/coordinate_transformer.py | 0 .../transformers/coordinate/fitz.py | 0 .../transformers/coordinate/fpdf.py | 0 .../transformers/coordinate/pdfnet.py | 0 .../transformer/transformers/response.py | 0 .../image_prediction}/utils.py | 0 .../image_prediction}/utils/__init__.py | 0 .../image_prediction}/utils/banner.py | 0 .../image_prediction}/utils/generic.py | 0 .../image_prediction}/utils/logger.py | 0 .../image_prediction}/utils/pdf_annotation.py | 0 .../utils/process_wrapping.py | 0 87 files changed, 59 insertions(+), 74 deletions(-) delete mode 100644 config.yaml delete mode 100644 image_prediction/config.py delete mode 100644 image_prediction/locations.py rename {image_prediction => src/image_prediction}/__init__.py (100%) rename {image_prediction => src/image_prediction}/classifier/__init__.py (100%) rename {image_prediction => src/image_prediction}/classifier/classifier.py (100%) rename {image_prediction => src/image_prediction}/classifier/image_classifier.py (100%) rename {image_prediction => src/image_prediction}/compositor/__init__.py (100%) rename {image_prediction => src/image_prediction}/compositor/compositor.py (100%) create mode 100644 src/image_prediction/config.py rename {image_prediction => src/image_prediction}/default_objects.py (100%) rename {image_prediction => src/image_prediction}/encoder/__init__.py (100%) rename {image_prediction => src/image_prediction}/encoder/encoder.py (100%) rename {image_prediction => src/image_prediction}/encoder/encoders/__init__.py (100%) rename {image_prediction => src/image_prediction}/encoder/encoders/hash_encoder.py (100%) rename {image_prediction => src/image_prediction}/estimator/__init__.py (100%) rename {image_prediction => src/image_prediction}/estimator/adapter/__init__.py (100%) rename {image_prediction => src/image_prediction}/estimator/adapter/adapter.py (100%) rename {image_prediction => src/image_prediction}/estimator/adapter/adapters/__init__.py (100%) rename {image_prediction => src/image_prediction}/estimator/preprocessor/__init__.py (100%) rename {image_prediction => src/image_prediction}/estimator/preprocessor/preprocessor.py (100%) rename {image_prediction => src/image_prediction}/estimator/preprocessor/preprocessors/__init__.py (100%) rename {image_prediction => src/image_prediction}/estimator/preprocessor/preprocessors/basic.py (100%) rename {image_prediction => src/image_prediction}/estimator/preprocessor/preprocessors/identity.py (100%) rename {image_prediction => src/image_prediction}/estimator/preprocessor/utils.py (100%) rename {image_prediction => src/image_prediction}/exceptions.py (100%) rename {image_prediction => src/image_prediction}/extraction.py (100%) rename {image_prediction => src/image_prediction}/flask.py (100%) rename {image_prediction => src/image_prediction}/formatter/__init__.py (100%) rename {image_prediction => src/image_prediction}/formatter/formatter.py (100%) rename {image_prediction => src/image_prediction}/formatter/formatters/__init__.py (100%) rename {image_prediction => src/image_prediction}/formatter/formatters/camel_case.py (100%) rename {image_prediction => src/image_prediction}/formatter/formatters/enum.py (100%) rename {image_prediction => src/image_prediction}/formatter/formatters/identity.py (100%) rename {image_prediction => src/image_prediction}/formatter/formatters/key_formatter.py (100%) rename {image_prediction => src/image_prediction}/image_extractor/__init__.py (100%) rename {image_prediction => src/image_prediction}/image_extractor/extractor.py (100%) rename {image_prediction => src/image_prediction}/image_extractor/extractors/__init__.py (100%) rename {image_prediction => src/image_prediction}/image_extractor/extractors/mock.py (100%) rename {image_prediction => src/image_prediction}/image_extractor/extractors/parsable.py (100%) rename {image_prediction => src/image_prediction}/info.py (100%) rename {image_prediction => src/image_prediction}/label_mapper/__init__.py (100%) rename {image_prediction => src/image_prediction}/label_mapper/mapper.py (100%) rename {image_prediction => src/image_prediction}/label_mapper/mappers/__init__.py (100%) rename {image_prediction => src/image_prediction}/label_mapper/mappers/numeric.py (100%) rename {image_prediction => src/image_prediction}/label_mapper/mappers/probability.py (100%) create mode 100644 src/image_prediction/locations.py rename {image_prediction => src/image_prediction}/model_loader/__init__.py (100%) rename {image_prediction => src/image_prediction}/model_loader/database/__init__.py (100%) rename {image_prediction => src/image_prediction}/model_loader/database/connector.py (100%) rename {image_prediction => src/image_prediction}/model_loader/database/connectors/__init__.py (100%) rename {image_prediction => src/image_prediction}/model_loader/database/connectors/mock.py (100%) rename {image_prediction => src/image_prediction}/model_loader/loader.py (100%) rename {image_prediction => src/image_prediction}/model_loader/loaders/__init__.py (100%) rename {image_prediction => src/image_prediction}/model_loader/loaders/mlflow.py (100%) rename {image_prediction => src/image_prediction}/pipeline.py (100%) rename {image_prediction => src/image_prediction}/redai_adapter/__init__.py (100%) rename {image_prediction => src/image_prediction}/redai_adapter/efficient_net_wrapper.py (100%) rename {image_prediction => src/image_prediction}/redai_adapter/mlflow.py (100%) rename {image_prediction => src/image_prediction}/redai_adapter/model.py (100%) rename {image_prediction => src/image_prediction}/redai_adapter/model_wrapper.py (100%) rename {image_prediction => src/image_prediction}/stitching/__init__.py (100%) rename {image_prediction => src/image_prediction}/stitching/grouping.py (100%) rename {image_prediction => src/image_prediction}/stitching/merging.py (100%) rename {image_prediction => src/image_prediction}/stitching/split_mapper.py (100%) rename {image_prediction => src/image_prediction}/stitching/stitching.py (100%) rename {image_prediction => src/image_prediction}/stitching/utils.py (100%) rename {image_prediction => src/image_prediction}/transformer/__init__.py (100%) rename {image_prediction => src/image_prediction}/transformer/transformer.py (100%) rename {image_prediction => src/image_prediction}/transformer/transformers/__init__.py (100%) rename {image_prediction => src/image_prediction}/transformer/transformers/coordinate/__init__.py (100%) rename {image_prediction => src/image_prediction}/transformer/transformers/coordinate/coordinate_transformer.py (100%) rename {image_prediction => src/image_prediction}/transformer/transformers/coordinate/fitz.py (100%) rename {image_prediction => src/image_prediction}/transformer/transformers/coordinate/fpdf.py (100%) rename {image_prediction => src/image_prediction}/transformer/transformers/coordinate/pdfnet.py (100%) rename {image_prediction => src/image_prediction}/transformer/transformers/response.py (100%) rename {image_prediction => src/image_prediction}/utils.py (100%) rename {image_prediction => src/image_prediction}/utils/__init__.py (100%) rename {image_prediction => src/image_prediction}/utils/banner.py (100%) rename {image_prediction => src/image_prediction}/utils/generic.py (100%) rename {image_prediction => src/image_prediction}/utils/logger.py (100%) rename {image_prediction => src/image_prediction}/utils/pdf_annotation.py (100%) rename {image_prediction => src/image_prediction}/utils/process_wrapping.py (100%) diff --git a/Dockerfile b/Dockerfile index b5b1d25..589d8d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,9 +20,9 @@ ENV PATH="$POETRY_HOME/bin:$PATH" RUN curl -sSL https://install.python-poetry.org | python3 - COPY ./data ./data -COPY ./scripts ./scripts -COPY ./image_prediction ./image_prediction -COPY pyproject.toml poetry.lock banner.txt config.yaml ./src ./ +COPY ./config ./config +COPY ./src ./src +COPY pyproject.toml poetry.lock banner.txt ./ RUN poetry config virtualenvs.create false && \ poetry config installer.max-workers 10 && \ @@ -30,9 +30,10 @@ RUN poetry config virtualenvs.create false && \ poetry config http-basic.${POETRY_SOURCE_REF_RESEARCH} ${USERNAME} ${TOKEN} && \ poetry config repositories.${POETRY_SOURCE_REF_RED} ${PYPI_REGISTRY_RED} && \ poetry config http-basic.${POETRY_SOURCE_REF_RED} ${USERNAME} ${TOKEN} && \ - poetry install --without=dev -vv --no-interaction --no-root + poetry install --without=dev -vv --no-interaction EXPOSE 5000 EXPOSE 8080 -CMD [ "python", "serve.py"] + +CMD [ "python", "src/serve.py"] diff --git a/Dockerfile_tests b/Dockerfile_tests index 4d3e6fd..a322919 100644 --- a/Dockerfile_tests +++ b/Dockerfile_tests @@ -20,9 +20,10 @@ ENV PATH="$POETRY_HOME/bin:$PATH" RUN curl -sSL https://install.python-poetry.org | python3 - COPY ./data ./data -COPY ./image_prediction ./image_prediction COPY ./test ./test -COPY pyproject.toml poetry.lock banner.txt config.yaml ./src ./ +COPY ./config ./config +COPY ./src ./src +COPY pyproject.toml poetry.lock banner.txt config.yaml./ RUN poetry config virtualenvs.create false && \ poetry config installer.max-workers 10 && \ diff --git a/config.yaml b/config.yaml deleted file mode 100644 index b0e5aa2..0000000 --- a/config.yaml +++ /dev/null @@ -1,24 +0,0 @@ -webserver: - host: $SERVER_HOST|"127.0.0.1" # webserver address - port: $SERVER_PORT|5000 # webserver port - -service: - logging_level: $LOGGING_LEVEL_ROOT|INFO # Logging level for service logger - verbose: $VERBOSE|False # Service DOES NOT prints document processing progress to stdout - batch_size: $BATCH_SIZE|16 # Number of images in memory simultaneously - mlflow_run_id: $MLFLOW_RUN_ID|fabfb1f192c745369b88cab34471aba7 # The ID of the mlflow run to load the service_estimator from - -# These variables control filters that are applied to either images, image metadata or service_estimator predictions. -# The filter result values are reported in the service responses. For convenience the response to a request contains a -# "filters.allPassed" field, which is set to false if any of the values returned by the filters did not meet its -# specified required value. -filters: - image_to_page_quotient: # Image size to page size ratio (ratio of geometric means of areas) - min: $MIN_REL_IMAGE_SIZE|0.05 # Minimum permissible - max: $MAX_REL_IMAGE_SIZE|0.75 # Maximum permissible - - image_width_to_height_quotient: # Image width to height ratio - min: $MIN_IMAGE_FORMAT|0.1 # Minimum permissible - max: $MAX_IMAGE_FORMAT|10 # Maximum permissible - - min_confidence: $MIN_CONFIDENCE|0.5 # Minimum permissible prediction confidence diff --git a/image_prediction/config.py b/image_prediction/config.py deleted file mode 100644 index e0cfa8b..0000000 --- a/image_prediction/config.py +++ /dev/null @@ -1,6 +0,0 @@ -from pathlib import Path - -from pyinfra.config.loader import load_settings - -local_root_path = Path(__file__).parents[1] -CONFIG = load_settings(root_path=local_root_path, settings_path="config") diff --git a/image_prediction/locations.py b/image_prediction/locations.py deleted file mode 100644 index 9374ace..0000000 --- a/image_prediction/locations.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Defines constant paths relative to the module root path.""" - -from pathlib import Path - -MODULE_DIR = Path(__file__).resolve().parents[0] -PACKAGE_ROOT_DIR = MODULE_DIR.parents[0] - -CONFIG_FILE = PACKAGE_ROOT_DIR / "config.yaml" -BANNER_FILE = PACKAGE_ROOT_DIR / "banner.txt" - -DATA_DIR = PACKAGE_ROOT_DIR / "data" -MLRUNS_DIR = str(DATA_DIR / "mlruns") - -TEST_DIR = PACKAGE_ROOT_DIR / "test" -TEST_DATA_DIR = TEST_DIR / "data" -TEST_DATA_DIR_DVC = TEST_DIR / "data.dvc" diff --git a/poetry.lock b/poetry.lock index 80e4911..8008429 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1097,29 +1097,33 @@ urllib3 = ">=1.26.7,<3" [[package]] name = "debugpy" -version = "1.8.0" +version = "1.8.1" description = "An implementation of the Debug Adapter Protocol for Python" optional = false python-versions = ">=3.8" files = [ - {file = "debugpy-1.8.0-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:7fb95ca78f7ac43393cd0e0f2b6deda438ec7c5e47fa5d38553340897d2fbdfb"}, - {file = "debugpy-1.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef9ab7df0b9a42ed9c878afd3eaaff471fce3fa73df96022e1f5c9f8f8c87ada"}, - {file = "debugpy-1.8.0-cp310-cp310-win32.whl", hash = "sha256:a8b7a2fd27cd9f3553ac112f356ad4ca93338feadd8910277aff71ab24d8775f"}, - {file = "debugpy-1.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:5d9de202f5d42e62f932507ee8b21e30d49aae7e46d5b1dd5c908db1d7068637"}, - {file = "debugpy-1.8.0-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:ef54404365fae8d45cf450d0544ee40cefbcb9cb85ea7afe89a963c27028261e"}, - {file = "debugpy-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:60009b132c91951354f54363f8ebdf7457aeb150e84abba5ae251b8e9f29a8a6"}, - {file = "debugpy-1.8.0-cp311-cp311-win32.whl", hash = "sha256:8cd0197141eb9e8a4566794550cfdcdb8b3db0818bdf8c49a8e8f8053e56e38b"}, - {file = "debugpy-1.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:a64093656c4c64dc6a438e11d59369875d200bd5abb8f9b26c1f5f723622e153"}, - {file = "debugpy-1.8.0-cp38-cp38-macosx_11_0_x86_64.whl", hash = "sha256:b05a6b503ed520ad58c8dc682749113d2fd9f41ffd45daec16e558ca884008cd"}, - {file = "debugpy-1.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c6fb41c98ec51dd010d7ed650accfd07a87fe5e93eca9d5f584d0578f28f35f"}, - {file = "debugpy-1.8.0-cp38-cp38-win32.whl", hash = "sha256:46ab6780159eeabb43c1495d9c84cf85d62975e48b6ec21ee10c95767c0590aa"}, - {file = "debugpy-1.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:bdc5ef99d14b9c0fcb35351b4fbfc06ac0ee576aeab6b2511702e5a648a2e595"}, - {file = "debugpy-1.8.0-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:61eab4a4c8b6125d41a34bad4e5fe3d2cc145caecd63c3fe953be4cc53e65bf8"}, - {file = "debugpy-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:125b9a637e013f9faac0a3d6a82bd17c8b5d2c875fb6b7e2772c5aba6d082332"}, - {file = "debugpy-1.8.0-cp39-cp39-win32.whl", hash = "sha256:57161629133113c97b387382045649a2b985a348f0c9366e22217c87b68b73c6"}, - {file = "debugpy-1.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:e3412f9faa9ade82aa64a50b602544efcba848c91384e9f93497a458767e6926"}, - {file = "debugpy-1.8.0-py2.py3-none-any.whl", hash = "sha256:9c9b0ac1ce2a42888199df1a1906e45e6f3c9555497643a85e0bf2406e3ffbc4"}, - {file = "debugpy-1.8.0.zip", hash = "sha256:12af2c55b419521e33d5fb21bd022df0b5eb267c3e178f1d374a63a2a6bdccd0"}, + {file = "debugpy-1.8.1-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:3bda0f1e943d386cc7a0e71bfa59f4137909e2ed947fb3946c506e113000f741"}, + {file = "debugpy-1.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dda73bf69ea479c8577a0448f8c707691152e6c4de7f0c4dec5a4bc11dee516e"}, + {file = "debugpy-1.8.1-cp310-cp310-win32.whl", hash = "sha256:3a79c6f62adef994b2dbe9fc2cc9cc3864a23575b6e387339ab739873bea53d0"}, + {file = "debugpy-1.8.1-cp310-cp310-win_amd64.whl", hash = "sha256:7eb7bd2b56ea3bedb009616d9e2f64aab8fc7000d481faec3cd26c98a964bcdd"}, + {file = "debugpy-1.8.1-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:016a9fcfc2c6b57f939673c874310d8581d51a0fe0858e7fac4e240c5eb743cb"}, + {file = "debugpy-1.8.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd97ed11a4c7f6d042d320ce03d83b20c3fb40da892f994bc041bbc415d7a099"}, + {file = "debugpy-1.8.1-cp311-cp311-win32.whl", hash = "sha256:0de56aba8249c28a300bdb0672a9b94785074eb82eb672db66c8144fff673146"}, + {file = "debugpy-1.8.1-cp311-cp311-win_amd64.whl", hash = "sha256:1a9fe0829c2b854757b4fd0a338d93bc17249a3bf69ecf765c61d4c522bb92a8"}, + {file = "debugpy-1.8.1-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:3ebb70ba1a6524d19fa7bb122f44b74170c447d5746a503e36adc244a20ac539"}, + {file = "debugpy-1.8.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a2e658a9630f27534e63922ebf655a6ab60c370f4d2fc5c02a5b19baf4410ace"}, + {file = "debugpy-1.8.1-cp312-cp312-win32.whl", hash = "sha256:caad2846e21188797a1f17fc09c31b84c7c3c23baf2516fed5b40b378515bbf0"}, + {file = "debugpy-1.8.1-cp312-cp312-win_amd64.whl", hash = "sha256:edcc9f58ec0fd121a25bc950d4578df47428d72e1a0d66c07403b04eb93bcf98"}, + {file = "debugpy-1.8.1-cp38-cp38-macosx_11_0_x86_64.whl", hash = "sha256:7a3afa222f6fd3d9dfecd52729bc2e12c93e22a7491405a0ecbf9e1d32d45b39"}, + {file = "debugpy-1.8.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d915a18f0597ef685e88bb35e5d7ab968964b7befefe1aaea1eb5b2640b586c7"}, + {file = "debugpy-1.8.1-cp38-cp38-win32.whl", hash = "sha256:92116039b5500633cc8d44ecc187abe2dfa9b90f7a82bbf81d079fcdd506bae9"}, + {file = "debugpy-1.8.1-cp38-cp38-win_amd64.whl", hash = "sha256:e38beb7992b5afd9d5244e96ad5fa9135e94993b0c551ceebf3fe1a5d9beb234"}, + {file = "debugpy-1.8.1-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:bfb20cb57486c8e4793d41996652e5a6a885b4d9175dd369045dad59eaacea42"}, + {file = "debugpy-1.8.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:efd3fdd3f67a7e576dd869c184c5dd71d9aaa36ded271939da352880c012e703"}, + {file = "debugpy-1.8.1-cp39-cp39-win32.whl", hash = "sha256:58911e8521ca0c785ac7a0539f1e77e0ce2df753f786188f382229278b4cdf23"}, + {file = "debugpy-1.8.1-cp39-cp39-win_amd64.whl", hash = "sha256:6df9aa9599eb05ca179fb0b810282255202a66835c6efb1d112d21ecb830ddd3"}, + {file = "debugpy-1.8.1-py2.py3-none-any.whl", hash = "sha256:28acbe2241222b87e255260c76741e1fbf04fdc3b6d094fcf57b6c6f75ce1242"}, + {file = "debugpy-1.8.1.zip", hash = "sha256:f696d6be15be87aef621917585f9bb94b1dc9e8aced570db1b8a6fc14e8f9b42"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 08db5b4..ae30bc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [tool.poetry] name = "image-classification-service" -version = "1.34.0" +version = "2.0.0" description = "" authors = ["Team Research "] readme = "README.md" -packages = [{ include = "image_prediction" }] +packages = [{ include = "image_prediction", from = "src" }] [tool.poetry.dependencies] python = ">=3.10,<3.11" diff --git a/image_prediction/__init__.py b/src/image_prediction/__init__.py similarity index 100% rename from image_prediction/__init__.py rename to src/image_prediction/__init__.py diff --git a/image_prediction/classifier/__init__.py b/src/image_prediction/classifier/__init__.py similarity index 100% rename from image_prediction/classifier/__init__.py rename to src/image_prediction/classifier/__init__.py diff --git a/image_prediction/classifier/classifier.py b/src/image_prediction/classifier/classifier.py similarity index 100% rename from image_prediction/classifier/classifier.py rename to src/image_prediction/classifier/classifier.py diff --git a/image_prediction/classifier/image_classifier.py b/src/image_prediction/classifier/image_classifier.py similarity index 100% rename from image_prediction/classifier/image_classifier.py rename to src/image_prediction/classifier/image_classifier.py diff --git a/image_prediction/compositor/__init__.py b/src/image_prediction/compositor/__init__.py similarity index 100% rename from image_prediction/compositor/__init__.py rename to src/image_prediction/compositor/__init__.py diff --git a/image_prediction/compositor/compositor.py b/src/image_prediction/compositor/compositor.py similarity index 100% rename from image_prediction/compositor/compositor.py rename to src/image_prediction/compositor/compositor.py diff --git a/src/image_prediction/config.py b/src/image_prediction/config.py new file mode 100644 index 0000000..b0f872b --- /dev/null +++ b/src/image_prediction/config.py @@ -0,0 +1,7 @@ +from pathlib import Path + +from pyinfra.config.loader import load_settings + +from image_prediction.locations import PROJECT_ROOT_DIR + +CONFIG = load_settings(root_path=PROJECT_ROOT_DIR, settings_path="config") diff --git a/image_prediction/default_objects.py b/src/image_prediction/default_objects.py similarity index 100% rename from image_prediction/default_objects.py rename to src/image_prediction/default_objects.py diff --git a/image_prediction/encoder/__init__.py b/src/image_prediction/encoder/__init__.py similarity index 100% rename from image_prediction/encoder/__init__.py rename to src/image_prediction/encoder/__init__.py diff --git a/image_prediction/encoder/encoder.py b/src/image_prediction/encoder/encoder.py similarity index 100% rename from image_prediction/encoder/encoder.py rename to src/image_prediction/encoder/encoder.py diff --git a/image_prediction/encoder/encoders/__init__.py b/src/image_prediction/encoder/encoders/__init__.py similarity index 100% rename from image_prediction/encoder/encoders/__init__.py rename to src/image_prediction/encoder/encoders/__init__.py diff --git a/image_prediction/encoder/encoders/hash_encoder.py b/src/image_prediction/encoder/encoders/hash_encoder.py similarity index 100% rename from image_prediction/encoder/encoders/hash_encoder.py rename to src/image_prediction/encoder/encoders/hash_encoder.py diff --git a/image_prediction/estimator/__init__.py b/src/image_prediction/estimator/__init__.py similarity index 100% rename from image_prediction/estimator/__init__.py rename to src/image_prediction/estimator/__init__.py diff --git a/image_prediction/estimator/adapter/__init__.py b/src/image_prediction/estimator/adapter/__init__.py similarity index 100% rename from image_prediction/estimator/adapter/__init__.py rename to src/image_prediction/estimator/adapter/__init__.py diff --git a/image_prediction/estimator/adapter/adapter.py b/src/image_prediction/estimator/adapter/adapter.py similarity index 100% rename from image_prediction/estimator/adapter/adapter.py rename to src/image_prediction/estimator/adapter/adapter.py diff --git a/image_prediction/estimator/adapter/adapters/__init__.py b/src/image_prediction/estimator/adapter/adapters/__init__.py similarity index 100% rename from image_prediction/estimator/adapter/adapters/__init__.py rename to src/image_prediction/estimator/adapter/adapters/__init__.py diff --git a/image_prediction/estimator/preprocessor/__init__.py b/src/image_prediction/estimator/preprocessor/__init__.py similarity index 100% rename from image_prediction/estimator/preprocessor/__init__.py rename to src/image_prediction/estimator/preprocessor/__init__.py diff --git a/image_prediction/estimator/preprocessor/preprocessor.py b/src/image_prediction/estimator/preprocessor/preprocessor.py similarity index 100% rename from image_prediction/estimator/preprocessor/preprocessor.py rename to src/image_prediction/estimator/preprocessor/preprocessor.py diff --git a/image_prediction/estimator/preprocessor/preprocessors/__init__.py b/src/image_prediction/estimator/preprocessor/preprocessors/__init__.py similarity index 100% rename from image_prediction/estimator/preprocessor/preprocessors/__init__.py rename to src/image_prediction/estimator/preprocessor/preprocessors/__init__.py diff --git a/image_prediction/estimator/preprocessor/preprocessors/basic.py b/src/image_prediction/estimator/preprocessor/preprocessors/basic.py similarity index 100% rename from image_prediction/estimator/preprocessor/preprocessors/basic.py rename to src/image_prediction/estimator/preprocessor/preprocessors/basic.py diff --git a/image_prediction/estimator/preprocessor/preprocessors/identity.py b/src/image_prediction/estimator/preprocessor/preprocessors/identity.py similarity index 100% rename from image_prediction/estimator/preprocessor/preprocessors/identity.py rename to src/image_prediction/estimator/preprocessor/preprocessors/identity.py diff --git a/image_prediction/estimator/preprocessor/utils.py b/src/image_prediction/estimator/preprocessor/utils.py similarity index 100% rename from image_prediction/estimator/preprocessor/utils.py rename to src/image_prediction/estimator/preprocessor/utils.py diff --git a/image_prediction/exceptions.py b/src/image_prediction/exceptions.py similarity index 100% rename from image_prediction/exceptions.py rename to src/image_prediction/exceptions.py diff --git a/image_prediction/extraction.py b/src/image_prediction/extraction.py similarity index 100% rename from image_prediction/extraction.py rename to src/image_prediction/extraction.py diff --git a/image_prediction/flask.py b/src/image_prediction/flask.py similarity index 100% rename from image_prediction/flask.py rename to src/image_prediction/flask.py diff --git a/image_prediction/formatter/__init__.py b/src/image_prediction/formatter/__init__.py similarity index 100% rename from image_prediction/formatter/__init__.py rename to src/image_prediction/formatter/__init__.py diff --git a/image_prediction/formatter/formatter.py b/src/image_prediction/formatter/formatter.py similarity index 100% rename from image_prediction/formatter/formatter.py rename to src/image_prediction/formatter/formatter.py diff --git a/image_prediction/formatter/formatters/__init__.py b/src/image_prediction/formatter/formatters/__init__.py similarity index 100% rename from image_prediction/formatter/formatters/__init__.py rename to src/image_prediction/formatter/formatters/__init__.py diff --git a/image_prediction/formatter/formatters/camel_case.py b/src/image_prediction/formatter/formatters/camel_case.py similarity index 100% rename from image_prediction/formatter/formatters/camel_case.py rename to src/image_prediction/formatter/formatters/camel_case.py diff --git a/image_prediction/formatter/formatters/enum.py b/src/image_prediction/formatter/formatters/enum.py similarity index 100% rename from image_prediction/formatter/formatters/enum.py rename to src/image_prediction/formatter/formatters/enum.py diff --git a/image_prediction/formatter/formatters/identity.py b/src/image_prediction/formatter/formatters/identity.py similarity index 100% rename from image_prediction/formatter/formatters/identity.py rename to src/image_prediction/formatter/formatters/identity.py diff --git a/image_prediction/formatter/formatters/key_formatter.py b/src/image_prediction/formatter/formatters/key_formatter.py similarity index 100% rename from image_prediction/formatter/formatters/key_formatter.py rename to src/image_prediction/formatter/formatters/key_formatter.py diff --git a/image_prediction/image_extractor/__init__.py b/src/image_prediction/image_extractor/__init__.py similarity index 100% rename from image_prediction/image_extractor/__init__.py rename to src/image_prediction/image_extractor/__init__.py diff --git a/image_prediction/image_extractor/extractor.py b/src/image_prediction/image_extractor/extractor.py similarity index 100% rename from image_prediction/image_extractor/extractor.py rename to src/image_prediction/image_extractor/extractor.py diff --git a/image_prediction/image_extractor/extractors/__init__.py b/src/image_prediction/image_extractor/extractors/__init__.py similarity index 100% rename from image_prediction/image_extractor/extractors/__init__.py rename to src/image_prediction/image_extractor/extractors/__init__.py diff --git a/image_prediction/image_extractor/extractors/mock.py b/src/image_prediction/image_extractor/extractors/mock.py similarity index 100% rename from image_prediction/image_extractor/extractors/mock.py rename to src/image_prediction/image_extractor/extractors/mock.py diff --git a/image_prediction/image_extractor/extractors/parsable.py b/src/image_prediction/image_extractor/extractors/parsable.py similarity index 100% rename from image_prediction/image_extractor/extractors/parsable.py rename to src/image_prediction/image_extractor/extractors/parsable.py diff --git a/image_prediction/info.py b/src/image_prediction/info.py similarity index 100% rename from image_prediction/info.py rename to src/image_prediction/info.py diff --git a/image_prediction/label_mapper/__init__.py b/src/image_prediction/label_mapper/__init__.py similarity index 100% rename from image_prediction/label_mapper/__init__.py rename to src/image_prediction/label_mapper/__init__.py diff --git a/image_prediction/label_mapper/mapper.py b/src/image_prediction/label_mapper/mapper.py similarity index 100% rename from image_prediction/label_mapper/mapper.py rename to src/image_prediction/label_mapper/mapper.py diff --git a/image_prediction/label_mapper/mappers/__init__.py b/src/image_prediction/label_mapper/mappers/__init__.py similarity index 100% rename from image_prediction/label_mapper/mappers/__init__.py rename to src/image_prediction/label_mapper/mappers/__init__.py diff --git a/image_prediction/label_mapper/mappers/numeric.py b/src/image_prediction/label_mapper/mappers/numeric.py similarity index 100% rename from image_prediction/label_mapper/mappers/numeric.py rename to src/image_prediction/label_mapper/mappers/numeric.py diff --git a/image_prediction/label_mapper/mappers/probability.py b/src/image_prediction/label_mapper/mappers/probability.py similarity index 100% rename from image_prediction/label_mapper/mappers/probability.py rename to src/image_prediction/label_mapper/mappers/probability.py diff --git a/src/image_prediction/locations.py b/src/image_prediction/locations.py new file mode 100644 index 0000000..0bab502 --- /dev/null +++ b/src/image_prediction/locations.py @@ -0,0 +1,18 @@ +"""Defines constant paths relative to the module root path.""" + +from pathlib import Path + +# FIXME: move these paths to config, only depending on 'ROOT_PATH' environment variable. +MODULE_DIR = Path(__file__).resolve().parents[0] +PACKAGE_ROOT_DIR = MODULE_DIR.parents[0] +PROJECT_ROOT_DIR = PACKAGE_ROOT_DIR.parents[0] + +CONFIG_FILE = PROJECT_ROOT_DIR / "config" / "settings.toml" +BANNER_FILE = PROJECT_ROOT_DIR / "banner.txt" + +DATA_DIR = PROJECT_ROOT_DIR / "data" +MLRUNS_DIR = str(DATA_DIR / "mlruns") + +TEST_DIR = PROJECT_ROOT_DIR / "test" +TEST_DATA_DIR = TEST_DIR / "data" +TEST_DATA_DIR_DVC = TEST_DIR / "data.dvc" diff --git a/image_prediction/model_loader/__init__.py b/src/image_prediction/model_loader/__init__.py similarity index 100% rename from image_prediction/model_loader/__init__.py rename to src/image_prediction/model_loader/__init__.py diff --git a/image_prediction/model_loader/database/__init__.py b/src/image_prediction/model_loader/database/__init__.py similarity index 100% rename from image_prediction/model_loader/database/__init__.py rename to src/image_prediction/model_loader/database/__init__.py diff --git a/image_prediction/model_loader/database/connector.py b/src/image_prediction/model_loader/database/connector.py similarity index 100% rename from image_prediction/model_loader/database/connector.py rename to src/image_prediction/model_loader/database/connector.py diff --git a/image_prediction/model_loader/database/connectors/__init__.py b/src/image_prediction/model_loader/database/connectors/__init__.py similarity index 100% rename from image_prediction/model_loader/database/connectors/__init__.py rename to src/image_prediction/model_loader/database/connectors/__init__.py diff --git a/image_prediction/model_loader/database/connectors/mock.py b/src/image_prediction/model_loader/database/connectors/mock.py similarity index 100% rename from image_prediction/model_loader/database/connectors/mock.py rename to src/image_prediction/model_loader/database/connectors/mock.py diff --git a/image_prediction/model_loader/loader.py b/src/image_prediction/model_loader/loader.py similarity index 100% rename from image_prediction/model_loader/loader.py rename to src/image_prediction/model_loader/loader.py diff --git a/image_prediction/model_loader/loaders/__init__.py b/src/image_prediction/model_loader/loaders/__init__.py similarity index 100% rename from image_prediction/model_loader/loaders/__init__.py rename to src/image_prediction/model_loader/loaders/__init__.py diff --git a/image_prediction/model_loader/loaders/mlflow.py b/src/image_prediction/model_loader/loaders/mlflow.py similarity index 100% rename from image_prediction/model_loader/loaders/mlflow.py rename to src/image_prediction/model_loader/loaders/mlflow.py diff --git a/image_prediction/pipeline.py b/src/image_prediction/pipeline.py similarity index 100% rename from image_prediction/pipeline.py rename to src/image_prediction/pipeline.py diff --git a/image_prediction/redai_adapter/__init__.py b/src/image_prediction/redai_adapter/__init__.py similarity index 100% rename from image_prediction/redai_adapter/__init__.py rename to src/image_prediction/redai_adapter/__init__.py diff --git a/image_prediction/redai_adapter/efficient_net_wrapper.py b/src/image_prediction/redai_adapter/efficient_net_wrapper.py similarity index 100% rename from image_prediction/redai_adapter/efficient_net_wrapper.py rename to src/image_prediction/redai_adapter/efficient_net_wrapper.py diff --git a/image_prediction/redai_adapter/mlflow.py b/src/image_prediction/redai_adapter/mlflow.py similarity index 100% rename from image_prediction/redai_adapter/mlflow.py rename to src/image_prediction/redai_adapter/mlflow.py diff --git a/image_prediction/redai_adapter/model.py b/src/image_prediction/redai_adapter/model.py similarity index 100% rename from image_prediction/redai_adapter/model.py rename to src/image_prediction/redai_adapter/model.py diff --git a/image_prediction/redai_adapter/model_wrapper.py b/src/image_prediction/redai_adapter/model_wrapper.py similarity index 100% rename from image_prediction/redai_adapter/model_wrapper.py rename to src/image_prediction/redai_adapter/model_wrapper.py diff --git a/image_prediction/stitching/__init__.py b/src/image_prediction/stitching/__init__.py similarity index 100% rename from image_prediction/stitching/__init__.py rename to src/image_prediction/stitching/__init__.py diff --git a/image_prediction/stitching/grouping.py b/src/image_prediction/stitching/grouping.py similarity index 100% rename from image_prediction/stitching/grouping.py rename to src/image_prediction/stitching/grouping.py diff --git a/image_prediction/stitching/merging.py b/src/image_prediction/stitching/merging.py similarity index 100% rename from image_prediction/stitching/merging.py rename to src/image_prediction/stitching/merging.py diff --git a/image_prediction/stitching/split_mapper.py b/src/image_prediction/stitching/split_mapper.py similarity index 100% rename from image_prediction/stitching/split_mapper.py rename to src/image_prediction/stitching/split_mapper.py diff --git a/image_prediction/stitching/stitching.py b/src/image_prediction/stitching/stitching.py similarity index 100% rename from image_prediction/stitching/stitching.py rename to src/image_prediction/stitching/stitching.py diff --git a/image_prediction/stitching/utils.py b/src/image_prediction/stitching/utils.py similarity index 100% rename from image_prediction/stitching/utils.py rename to src/image_prediction/stitching/utils.py diff --git a/image_prediction/transformer/__init__.py b/src/image_prediction/transformer/__init__.py similarity index 100% rename from image_prediction/transformer/__init__.py rename to src/image_prediction/transformer/__init__.py diff --git a/image_prediction/transformer/transformer.py b/src/image_prediction/transformer/transformer.py similarity index 100% rename from image_prediction/transformer/transformer.py rename to src/image_prediction/transformer/transformer.py diff --git a/image_prediction/transformer/transformers/__init__.py b/src/image_prediction/transformer/transformers/__init__.py similarity index 100% rename from image_prediction/transformer/transformers/__init__.py rename to src/image_prediction/transformer/transformers/__init__.py diff --git a/image_prediction/transformer/transformers/coordinate/__init__.py b/src/image_prediction/transformer/transformers/coordinate/__init__.py similarity index 100% rename from image_prediction/transformer/transformers/coordinate/__init__.py rename to src/image_prediction/transformer/transformers/coordinate/__init__.py diff --git a/image_prediction/transformer/transformers/coordinate/coordinate_transformer.py b/src/image_prediction/transformer/transformers/coordinate/coordinate_transformer.py similarity index 100% rename from image_prediction/transformer/transformers/coordinate/coordinate_transformer.py rename to src/image_prediction/transformer/transformers/coordinate/coordinate_transformer.py diff --git a/image_prediction/transformer/transformers/coordinate/fitz.py b/src/image_prediction/transformer/transformers/coordinate/fitz.py similarity index 100% rename from image_prediction/transformer/transformers/coordinate/fitz.py rename to src/image_prediction/transformer/transformers/coordinate/fitz.py diff --git a/image_prediction/transformer/transformers/coordinate/fpdf.py b/src/image_prediction/transformer/transformers/coordinate/fpdf.py similarity index 100% rename from image_prediction/transformer/transformers/coordinate/fpdf.py rename to src/image_prediction/transformer/transformers/coordinate/fpdf.py diff --git a/image_prediction/transformer/transformers/coordinate/pdfnet.py b/src/image_prediction/transformer/transformers/coordinate/pdfnet.py similarity index 100% rename from image_prediction/transformer/transformers/coordinate/pdfnet.py rename to src/image_prediction/transformer/transformers/coordinate/pdfnet.py diff --git a/image_prediction/transformer/transformers/response.py b/src/image_prediction/transformer/transformers/response.py similarity index 100% rename from image_prediction/transformer/transformers/response.py rename to src/image_prediction/transformer/transformers/response.py diff --git a/image_prediction/utils.py b/src/image_prediction/utils.py similarity index 100% rename from image_prediction/utils.py rename to src/image_prediction/utils.py diff --git a/image_prediction/utils/__init__.py b/src/image_prediction/utils/__init__.py similarity index 100% rename from image_prediction/utils/__init__.py rename to src/image_prediction/utils/__init__.py diff --git a/image_prediction/utils/banner.py b/src/image_prediction/utils/banner.py similarity index 100% rename from image_prediction/utils/banner.py rename to src/image_prediction/utils/banner.py diff --git a/image_prediction/utils/generic.py b/src/image_prediction/utils/generic.py similarity index 100% rename from image_prediction/utils/generic.py rename to src/image_prediction/utils/generic.py diff --git a/image_prediction/utils/logger.py b/src/image_prediction/utils/logger.py similarity index 100% rename from image_prediction/utils/logger.py rename to src/image_prediction/utils/logger.py diff --git a/image_prediction/utils/pdf_annotation.py b/src/image_prediction/utils/pdf_annotation.py similarity index 100% rename from image_prediction/utils/pdf_annotation.py rename to src/image_prediction/utils/pdf_annotation.py diff --git a/image_prediction/utils/process_wrapping.py b/src/image_prediction/utils/process_wrapping.py similarity index 100% rename from image_prediction/utils/process_wrapping.py rename to src/image_prediction/utils/process_wrapping.py