diff --git a/flaskml_migration_steps.md b/flaskml_migration_steps.md index 393d0591..8264cedc 100644 --- a/flaskml_migration_steps.md +++ b/flaskml_migration_steps.md @@ -82,6 +82,11 @@ poetry run python src/text-summary/text_summary/main.py /text_summarization/summ poetry run python src/text-summary/text_summary/main.py /text_summarization/summarize/task_schema ``` -16. Add tests for your app in src//tests. You can use the tests in src/audio-transcription/tests as a reference. +16. Add tests for your app in src//tests. You can use the tests in src/audio-transcription/tests as a reference. Extend the rb.lib.common_tests.RBAppTest class to test your app. RBAppTest automatically tests the routes, app metadata, and task schema in both the command line and the API. Add additional tests to test the ML service in your app. Refer to the following files for examples to learn from: +``` +src/audio-transcription/tests/test_main.py +src/text-summary/tests/test_main_text_summary.py +src/age_and_gender_detection/tests/test_main_age_gender.py +``` 17. Make sure all the tests pass and the Github Actions workflow is successful. Refer to .github/workflows/ for the workflow files. 18. Send your pull request for review. Someone from the team will review your code and provide feedback. The PR requires at least one approval from a team member before it can be merged. \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index f70e729e..5082a95b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -11,10 +11,9 @@ files = [] develop = true [package.dependencies] -flask-ml = ">=0.2.5,<0.3.0" numpy = "*" -onnxruntime = "1.21.0" -opencv-python = ">=4.11.0.86,<5.0.0.0" +onnxruntime = "*" +opencv-python = "*" [package.source] type = "directory" @@ -81,21 +80,6 @@ files = [ [package.dependencies] six = "*" -[[package]] -name = "argcomplete" -version = "3.6.2" -description = "Bash tab completion for argparse" -optional = false -python-versions = ">=3.8" -groups = ["main"] -files = [ - {file = "argcomplete-3.6.2-py3-none-any.whl", hash = "sha256:65b3133a29ad53fb42c48cf5114752c7ab66c1c38544fdf6460f450c09b42591"}, - {file = "argcomplete-3.6.2.tar.gz", hash = "sha256:d0519b1bc867f5f4f4713c41ad0aba73a4a5f007449716b16f385f2166dc6adf"}, -] - -[package.extras] -test = ["coverage", "mypy", "pexpect", "ruff", "wheel"] - [[package]] name = "audio-transcription" version = "0.1.0" @@ -143,7 +127,7 @@ version = "24.10.0" description = "The uncompromising code formatter." optional = false python-versions = ">=3.9" -groups = ["main", "dev"] +groups = ["dev"] files = [ {file = "black-24.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e6668650ea4b685440857138e5fe40cde4d652633b1bdffc62933d0db4ed9812"}, {file = "black-24.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1c536fcf674217e87b8cc3657b81809d3c085d7bf3ef262ead700da345bfa6ea"}, @@ -182,18 +166,6 @@ d = ["aiohttp (>=3.10)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] -[[package]] -name = "blinker" -version = "1.9.0" -description = "Fast, simple object-to-object and broadcast signaling" -optional = false -python-versions = ">=3.9" -groups = ["main"] -files = [ - {file = "blinker-1.9.0-py3-none-any.whl", hash = "sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc"}, - {file = "blinker-1.9.0.tar.gz", hash = "sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf"}, -] - [[package]] name = "certifi" version = "2025.1.31" @@ -395,38 +367,6 @@ humanfriendly = ">=9.1" [package.extras] cron = ["capturer (>=2.4)"] -[[package]] -name = "datamodel-code-generator" -version = "0.28.5" -description = "Datamodel Code Generator" -optional = false -python-versions = ">=3.9" -groups = ["main"] -files = [ - {file = "datamodel_code_generator-0.28.5-py3-none-any.whl", hash = "sha256:f899c1da5af04b5d5b6e3edbd718c1bf3a00fc4b2fe8210cef609d93a9983e9e"}, - {file = "datamodel_code_generator-0.28.5.tar.gz", hash = "sha256:20e8b817d301d2d0bb15f436e81c97b25ad1c2ef922c99249c2444141ae15a6a"}, -] - -[package.dependencies] -argcomplete = ">=2.10.1,<4" -black = ">=19.10b0" -genson = ">=1.2.1,<2" -inflect = ">=4.1,<6" -isort = ">=4.3.21,<7" -jinja2 = ">=2.10.1,<4" -packaging = "*" -pydantic = ">=1.5" -pyyaml = ">=6.0.1" -tomli = {version = ">=2.2.1,<3", markers = "python_version <= \"3.11\""} - -[package.extras] -all = ["graphql-core (>=3.2.3)", "httpx (>=0.24.1)", "openapi-spec-validator (>=0.2.8,<0.7)", "prance (>=0.18.2)", "pysnooper (>=0.4.1,<2)", "ruff (>=0.9.10)"] -debug = ["pysnooper (>=0.4.1,<2)"] -graphql = ["graphql-core (>=3.2.3)"] -http = ["httpx (>=0.24.1)"] -ruff = ["ruff (>=0.9.10)"] -validation = ["openapi-spec-validator (>=0.2.8,<0.7)", "prance (>=0.18.2)"] - [[package]] name = "distlib" version = "0.3.9" @@ -514,50 +454,6 @@ docs = ["furo (>=2024.8.6)", "sphinx (>=8.1.3)", "sphinx-autodoc-typehints (>=3) testing = ["covdefaults (>=2.3)", "coverage (>=7.6.10)", "diff-cover (>=9.2.1)", "pytest (>=8.3.4)", "pytest-asyncio (>=0.25.2)", "pytest-cov (>=6)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.28.1)"] typing = ["typing-extensions (>=4.12.2) ; python_version < \"3.11\""] -[[package]] -name = "flask" -version = "3.1.0" -description = "A simple framework for building complex web applications." -optional = false -python-versions = ">=3.9" -groups = ["main"] -files = [ - {file = "flask-3.1.0-py3-none-any.whl", hash = "sha256:d667207822eb83f1c4b50949b1623c8fc8d51f2341d65f72e1a1815397551136"}, - {file = "flask-3.1.0.tar.gz", hash = "sha256:5f873c5184c897c8d9d1b05df1e3d01b14910ce69607a117bd3277098a5836ac"}, -] - -[package.dependencies] -blinker = ">=1.9" -click = ">=8.1.3" -itsdangerous = ">=2.2" -Jinja2 = ">=3.1.2" -Werkzeug = ">=3.1" - -[package.extras] -async = ["asgiref (>=3.2)"] -dotenv = ["python-dotenv"] - -[[package]] -name = "flask-ml" -version = "0.2.5" -description = "A Flask extension for running machine learning code" -optional = false -python-versions = ">=3.10" -groups = ["main"] -files = [ - {file = "flask_ml-0.2.5-py3-none-any.whl", hash = "sha256:8dcf090060d49ccc5d9085e6cbc85f47ecc6e589c88fcbe6ad3dd3dd738cc414"}, - {file = "flask_ml-0.2.5.tar.gz", hash = "sha256:20169854c7bb70fe6f1b21f6065eab91374c98cc51a97a6f57147bd8eb165e78"}, -] - -[package.dependencies] -datamodel-code-generator = "*" -flask = "*" -pydantic = "*" -requests = "*" - -[package.extras] -dev = ["autoflake8", "black", "flake8", "isort", "mypy", "pytest", "pytest-cov", "types-requests"] - [[package]] name = "flatbuffers" version = "25.2.10" @@ -610,18 +506,6 @@ test-downstream = ["aiobotocore (>=2.5.4,<3.0.0)", "dask[dataframe,test]", "moto test-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "cloudpickle", "dask", "distributed", "dropbox", "dropboxdrivefs", "fastparquet", "fusepy", "gcsfs", "jinja2", "kerchunk", "libarchive-c", "lz4", "notebook", "numpy", "ocifs", "pandas", "panel", "paramiko", "pyarrow", "pyarrow (>=1)", "pyftpdlib", "pygit2", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "python-snappy", "requests", "smbprotocol", "tqdm", "urllib3", "zarr", "zstandard"] tqdm = ["tqdm"] -[[package]] -name = "genson" -version = "1.3.0" -description = "GenSON is a powerful, user-friendly JSON Schema generator." -optional = false -python-versions = "*" -groups = ["main"] -files = [ - {file = "genson-1.3.0-py3-none-any.whl", hash = "sha256:468feccd00274cc7e4c09e84b08704270ba8d95232aa280f65b986139cec67f7"}, - {file = "genson-1.3.0.tar.gz", hash = "sha256:e02db9ac2e3fd29e65b5286f7135762e2cd8a986537c075b06fc5f1517308e37"}, -] - [[package]] name = "h11" version = "0.14.0" @@ -726,22 +610,6 @@ files = [ [package.extras] all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] -[[package]] -name = "inflect" -version = "5.6.2" -description = "Correctly generate plurals, singular nouns, ordinals, indefinite articles; convert numbers to words" -optional = false -python-versions = ">=3.7" -groups = ["main"] -files = [ - {file = "inflect-5.6.2-py3-none-any.whl", hash = "sha256:b45d91a4a28a4e617ff1821117439b06eaa86e2a4573154af0149e9be6687238"}, - {file = "inflect-5.6.2.tar.gz", hash = "sha256:aadc7ed73928f5e014129794bbac03058cca35d0a973a5fc4eb45c7fa26005f9"}, -] - -[package.extras] -docs = ["jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx"] -testing = ["pygments", "pytest (>=6)", "pytest-black (>=0.3.7) ; platform_python_implementation != \"PyPy\"", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1) ; platform_python_implementation != \"PyPy\""] - [[package]] name = "iniconfig" version = "2.1.0" @@ -760,7 +628,7 @@ version = "5.13.2" description = "A Python utility / library to sort Python imports." optional = false python-versions = ">=3.8.0" -groups = ["main", "dev"] +groups = ["dev"] files = [ {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, @@ -769,18 +637,6 @@ files = [ [package.extras] colors = ["colorama (>=0.4.6)"] -[[package]] -name = "itsdangerous" -version = "2.2.0" -description = "Safely pass data to untrusted environments and back." -optional = false -python-versions = ">=3.8" -groups = ["main"] -files = [ - {file = "itsdangerous-2.2.0-py3-none-any.whl", hash = "sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef"}, - {file = "itsdangerous-2.2.0.tar.gz", hash = "sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173"}, -] - [[package]] name = "jinja2" version = "3.1.6" @@ -1021,7 +877,7 @@ version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." optional = false python-versions = ">=3.5" -groups = ["main", "dev"] +groups = ["dev"] files = [ {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, @@ -1440,7 +1296,7 @@ version = "0.12.1" description = "Utility library for gitignore style pattern matching of file paths." optional = false python-versions = ">=3.8" -groups = ["main", "dev"] +groups = ["dev"] files = [ {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, @@ -1465,7 +1321,7 @@ version = "4.3.7" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.9" -groups = ["main", "dev"] +groups = ["dev"] files = [ {file = "platformdirs-4.3.7-py3-none-any.whl", hash = "sha256:a03875334331946f13c549dbd8f4bac7a13a50a895a0eb1e8c6a8ace80d40a94"}, {file = "platformdirs-4.3.7.tar.gz", hash = "sha256:eb437d586b6a0986388f0d6f74aa0cde27b48d0e3d66843640bfb6bdcdb6e351"}, @@ -1532,14 +1388,14 @@ files = [ [[package]] name = "pydantic" -version = "2.11.2" +version = "2.11.3" description = "Data validation using Python type hints" optional = false python-versions = ">=3.9" groups = ["main", "api"] files = [ - {file = "pydantic-2.11.2-py3-none-any.whl", hash = "sha256:7f17d25846bcdf89b670a86cdfe7b29a9f1c9ca23dee154221c9aa81845cfca7"}, - {file = "pydantic-2.11.2.tar.gz", hash = "sha256:2138628e050bd7a1e70b91d4bf4a91167f4ad76fdb83209b107c8d84b854917e"}, + {file = "pydantic-2.11.3-py3-none-any.whl", hash = "sha256:a082753436a07f9ba1289c6ffa01cd93db3548776088aa917cc43b63f68fa60f"}, + {file = "pydantic-2.11.3.tar.gz", hash = "sha256:7471657138c16adad9322fe3070c0116dd6c3ad8d649300e3cbdfe91f4db4ec3"}, ] [package.dependencies] @@ -2194,9 +2050,8 @@ files = [] develop = true [package.dependencies] -flask-ml = ">=0.2.5,<0.3.0" -ollama = ">=0.4.7,<0.5.0" -pypdf2 = ">=3.0.1,<4.0.0" +ollama = "*" +pypdf2 = "*" [package.source] type = "directory" @@ -2250,49 +2105,6 @@ requests = ">=2.26.0" [package.extras] blobfile = ["blobfile (>=2)"] -[[package]] -name = "tomli" -version = "2.2.1" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.8" -groups = ["main"] -markers = "python_version == \"3.11\"" -files = [ - {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, - {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, - {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, - {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, - {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, - {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, - {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, - {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, - {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, - {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, -] - [[package]] name = "torch" version = "2.4.1" @@ -2497,24 +2309,6 @@ platformdirs = ">=3.9.1,<5" docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8) ; platform_python_implementation == \"PyPy\" or platform_python_implementation == \"GraalVM\" or platform_python_implementation == \"CPython\" and sys_platform == \"win32\" and python_version >= \"3.13\"", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10) ; platform_python_implementation == \"CPython\""] -[[package]] -name = "werkzeug" -version = "3.1.3" -description = "The comprehensive WSGI web application library." -optional = false -python-versions = ">=3.9" -groups = ["main"] -files = [ - {file = "werkzeug-3.1.3-py3-none-any.whl", hash = "sha256:54b78bf3716d19a65be4fceccc0d1d7b89e608834989dfae50ea87564639213e"}, - {file = "werkzeug-3.1.3.tar.gz", hash = "sha256:60723ce945c19328679790e3282cc758aa4a6040e4bb330f53d30fa546d44746"}, -] - -[package.dependencies] -MarkupSafe = ">=2.1.1" - -[package.extras] -watchdog = ["watchdog (>=2.3)"] - [[package]] name = "win32-setctime" version = "1.2.0" @@ -2534,4 +2328,4 @@ dev = ["black (>=19.3b0) ; python_version >= \"3.6\"", "pytest (>=4.6.2)"] [metadata] lock-version = "2.1" python-versions = ">=3.11,<3.13" -content-hash = "21d65c84cfc237b3cc77155c264a62d5d80353f03c8c8c83e7cb6709985979fe" +content-hash = "cdb6d01e939e10b55aaa7b42eaa8bf59eff5ec49b6af4ec92ef11262812a48bd" diff --git a/pyproject.toml b/pyproject.toml index 55937702..62f70fa1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,10 @@ pytest = "^8.3.4" httpx = "^0.28.1" # add dependencies common to all plugins here numpy = "2.1.0" +onnxruntime = "1.21.0" +opencv-python = ">=4.11.0.86,<5.0.0.0" +ollama = ">=0.4.7,<0.5.0" +pypdf2 = ">=3.0.1,<4.0.0" rb-lib = { path = "src/rb-lib", develop = true } diff --git a/src/age_and_gender_detection/age_and_gender_detection/img-app-info.md b/src/age_and_gender_detection/age_and_gender_detection/img-app-info.md deleted file mode 100644 index dc9805cc..00000000 --- a/src/age_and_gender_detection/age_and_gender_detection/img-app-info.md +++ /dev/null @@ -1 +0,0 @@ -## Age and Gender Classification \ No newline at end of file diff --git a/src/age_and_gender_detection/pyproject.toml b/src/age_and_gender_detection/pyproject.toml index 67c16c90..f14d9a32 100644 --- a/src/age_and_gender_detection/pyproject.toml +++ b/src/age_and_gender_detection/pyproject.toml @@ -1,20 +1,19 @@ -[project] +[tool.poetry] name = "age_and_gender_detection" version = "0.1.0" description = "Age and Gender Classification" -authors = [ - {name = "Prasanna",email = "prasanna.lakkur@gmail.com"} -] -license = {text = "MIT License"} -readme = "README.md" -dependencies = [ - "numpy", - "onnxruntime (==1.21.0)", - "opencv-python (>=4.11.0.86,<5.0.0.0)", - "flask-ml (>=0.2.5,<0.3.0)" -] +authors = ["Prasanna "] +packages = [{include = "age_and_gender_detection"}] + +[tool.poetry.scripts] +age_and_gender_detection = "age_and_gender_detection.main:app" + +[tool.poetry.dependencies] +numpy = "*" +onnxruntime = "*" +opencv-python = "*" [build-system] -requires = ["poetry-core>=2.0.0,<3.0.0"] +requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/src/age_and_gender_detection/tests/test_main_age_gender.py b/src/age_and_gender_detection/tests/test_main_age_gender.py index 32ab11d7..8efe8183 100644 --- a/src/age_and_gender_detection/tests/test_main_age_gender.py +++ b/src/age_and_gender_detection/tests/test_main_age_gender.py @@ -18,17 +18,19 @@ def filter(self, record): format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", ) +TEST_IMAGES_DIR = Path("src/age_and_gender_detection/test_images") + EXPECTED_OUTPUT = { - "src/age_and_gender_detection/test_images/bella.jpg": [ + str(TEST_IMAGES_DIR / "bella.jpg"): [ {"box": [246, 257, 847, 858], "gender": "Female", "age": "(25-32)"} ], - "src/age_and_gender_detection/test_images/bruce.jpg": [ + str(TEST_IMAGES_DIR / "bruce.jpg"): [ {"box": [51, 122, 328, 399], "gender": "Male", "age": "(25-32)"} ], - "src/age_and_gender_detection/test_images/baby.jpg": [ + str(TEST_IMAGES_DIR / "baby.jpg"): [ {"box": [345, 217, 592, 464], "gender": "Female", "age": "(0-2)"} ], - "src/age_and_gender_detection/test_images/kid.jpg": [ + str(TEST_IMAGES_DIR / "kid.jpg"): [ {"box": [476, 143, 696, 364], "gender": "Male", "age": "(4-6)"} ], } @@ -79,10 +81,13 @@ def test_age_gender_command(self, caplog): result = self.runner.invoke(self.cli_app, [age_gender_api, str(input_path)]) assert result.exit_code == 0, f"Error: {result.output}" expected_files = [ - "src/age_and_gender_detection/test_images/bella.jpg", - "src/age_and_gender_detection/test_images/bruce.jpg", - "src/age_and_gender_detection/test_images/baby.jpg", - "src/age_and_gender_detection/test_images/kid.jpg", + str(Path(s)) + for s in [ + "src/age_and_gender_detection/test_images/bella.jpg", + "src/age_and_gender_detection/test_images/bruce.jpg", + "src/age_and_gender_detection/test_images/baby.jpg", + "src/age_and_gender_detection/test_images/kid.jpg", + ] ] for expected_file in expected_files: assert any(expected_file in message for message in caplog.messages) diff --git a/src/text-summary/pyproject.toml b/src/text-summary/pyproject.toml index bf01fd8f..83ba3825 100644 --- a/src/text-summary/pyproject.toml +++ b/src/text-summary/pyproject.toml @@ -1,19 +1,18 @@ -[project] +[tool.poetry] name = "text-summary" version = "0.1.0" description = "A project that helps summarize text." -authors = [ - {name = "Prasanna",email = "prasanna.lakkur@gmail.com"} -] -license = {text = "MIT"} -readme = "README.md" -dependencies = [ - "ollama (>=0.4.7,<0.5.0)", - "pypdf2 (>=3.0.1,<4.0.0)", - "flask-ml (>=0.2.5,<0.3.0)" -] +authors = ["Prasanna "] +packages = [{include = "text_summary"}] + +[tool.poetry.scripts] +text-summary = "text_summary.main:app" + +[tool.poetry.dependencies] +ollama = "*" +pypdf2 = "*" [build-system] -requires = ["poetry-core>=2.0.0,<3.0.0"] +requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/src/text-summary/tests/test_model.py b/src/text-summary/tests/test_model.py index 1ef9a916..3239e3a3 100644 --- a/src/text-summary/tests/test_model.py +++ b/src/text-summary/tests/test_model.py @@ -30,7 +30,7 @@ def test_ensure_model_exists(mock_pull): # Test case where pull fails mock_pull.return_value = MagicMock(status="failure") - with pytest.raises(RuntimeError, match="Failed to pull model 'gemma3:1b':"): + with pytest.raises(ValueError, match="Failed to pull model 'gemma3:1b':"): ensure_model_exists("gemma3:1b") diff --git a/src/text-summary/text_summary/cli.py b/src/text-summary/text_summary/cli.py deleted file mode 100644 index 600be5cf..00000000 --- a/src/text-summary/text_summary/cli.py +++ /dev/null @@ -1,23 +0,0 @@ -import argparse -from text_summary.model import SUPPORTED_MODELS -from text_summary.summarize import process_files - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Summarize text and PDF files in a directory." - ) - parser.add_argument( - "--input_dir", help="Path to input directory containing the input files" - ) - parser.add_argument( - "--output_dir", help="Path to output directory for summary files" - ) - parser.add_argument( - "--model", - choices=SUPPORTED_MODELS, - default="gemma3:1b", - help="Model to use for summarization (default: gemma3:1b)", - ) - args = parser.parse_args() - - process_files(args.model, args.input_dir, args.output_dir) diff --git a/src/text-summary/text_summary/model.py b/src/text-summary/text_summary/model.py index e569c97a..817f2281 100644 --- a/src/text-summary/text_summary/model.py +++ b/src/text-summary/text_summary/model.py @@ -24,9 +24,12 @@ def ensure_model_exists(model: str) -> None: raise ValueError( f"Model '{model}' is not supported. Supported models are: {SUPPORTED_MODELS}" ) - response = ollama.pull(model) + try: + response = ollama.pull(model) + except ollama.ResponseError as e: + raise ValueError(e.error) if response.status != "success": - raise RuntimeError(f"Failed to pull model '{model}': {response}") + raise ValueError(f"Failed to pull model '{model}': {response}") def summarize(model: str, text: str) -> str: