diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..89b88877f006586a6adb700a29185d3f156635cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,164 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +.mosal-demo-venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ +.vscode +notebooks/*example.ipynb +src/data/*.jpg \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..33dbc9e45a53e485ba1235617a6873cdcc9d2224 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# Use the official Python 3.9 image +FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9 + +# Set up a new user named "user" with user ID 1000 +RUN useradd -m -u 1000 user +# Switch to the "user" user +USER user +# Set home to the user's home directory +ENV HOME=/home/user \ + PATH=/home/user/.local/bin:$PATH + +# Set the working directory to the user's home directory +WORKDIR $HOME/app + +# Copy the current directory contents into the container at $HOME/app setting the owner to the user +COPY --chown=user . $HOME/app + +# Install requirements.txt +RUN pip install --no-cache-dir --upgrade -r requirements.txt + +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] diff --git a/README.md b/README.md index 1b8cf99c8de7c9e7511b4d78c64a61cf4e3a4261..228f87d243ffc9f46c509408699983e63aad49fb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ --- -title: Mosal Api -emoji: 🐢 -colorFrom: red -colorTo: green +title: Vit Tiny Patch16 224 2 +emoji: 🐨 +colorFrom: purple +colorTo: pink sdk: docker pinned: false license: apache-2.0 diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/0_Aa_15_JPG.rf.e549d62663b482e496e44becd27bae6b.jpg b/data/0_Aa_15_JPG.rf.e549d62663b482e496e44becd27bae6b.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dc50df2f4f70fe66af4491f5a58ad7030b631c62 Binary files /dev/null and b/data/0_Aa_15_JPG.rf.e549d62663b482e496e44becd27bae6b.jpg differ diff --git a/data/0_Aa_38_JPG.rf.6ca7c8e5084895e15fe46a6e80499a30.jpg b/data/0_Aa_38_JPG.rf.6ca7c8e5084895e15fe46a6e80499a30.jpg new file mode 100644 index 0000000000000000000000000000000000000000..718cea7ece7136280395cb353f71e63e9a71193d Binary files /dev/null and b/data/0_Aa_38_JPG.rf.6ca7c8e5084895e15fe46a6e80499a30.jpg differ diff --git a/data/0_Aa_50_JPG.rf.b1223bebc679fa65414d2222d70fb73b.jpg b/data/0_Aa_50_JPG.rf.b1223bebc679fa65414d2222d70fb73b.jpg new file mode 100644 index 0000000000000000000000000000000000000000..df13be3747a3484ad69942dd7c4d59d3eac9d075 Binary files /dev/null and b/data/0_Aa_50_JPG.rf.b1223bebc679fa65414d2222d70fb73b.jpg differ diff --git a/data/0_Aa_52_JPG.rf.9b1c0ac0417a7f62da3fe0729b2f2e31.jpg b/data/0_Aa_52_JPG.rf.9b1c0ac0417a7f62da3fe0729b2f2e31.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2424bee5f8b0d1359ab08fd925c76ab32509d908 Binary files /dev/null and b/data/0_Aa_52_JPG.rf.9b1c0ac0417a7f62da3fe0729b2f2e31.jpg differ diff --git a/data/0_Aa_60_JPG.rf.44a6a68c052e15cd0742bd7853a61d96.jpg b/data/0_Aa_60_JPG.rf.44a6a68c052e15cd0742bd7853a61d96.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bea76284c7cf9e7178fb3995a2748e974b5d9907 Binary files /dev/null and b/data/0_Aa_60_JPG.rf.44a6a68c052e15cd0742bd7853a61d96.jpg differ diff --git a/data/0_Aa_69_JPG.rf.9b4369d10e7ec805604c39f35ac7be34.jpg b/data/0_Aa_69_JPG.rf.9b4369d10e7ec805604c39f35ac7be34.jpg new file mode 100644 index 0000000000000000000000000000000000000000..221d1bd048d1adbe9fe98c877b82be1b4ba23435 Binary files /dev/null and b/data/0_Aa_69_JPG.rf.9b4369d10e7ec805604c39f35ac7be34.jpg differ diff --git a/data/0_Aa_73_JPG.rf.0598bf01c134cd2793e8bae9e938ce39.jpg b/data/0_Aa_73_JPG.rf.0598bf01c134cd2793e8bae9e938ce39.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4f4adbc705c4b3d35186faba691f57f46b609f65 Binary files /dev/null and b/data/0_Aa_73_JPG.rf.0598bf01c134cd2793e8bae9e938ce39.jpg differ diff --git a/data/0_Aa_83_JPG.rf.88f83cd3aa2fd0a709d29845f1618aa2.jpg b/data/0_Aa_83_JPG.rf.88f83cd3aa2fd0a709d29845f1618aa2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..731126d668f0d5589dd3fad45bdeb2fb9ab5c0f1 Binary files /dev/null and b/data/0_Aa_83_JPG.rf.88f83cd3aa2fd0a709d29845f1618aa2.jpg differ diff --git a/data/0_Aa_93_JPG.rf.776c7121bb3e9e5e3c92e54ee2ac3eb2.jpg b/data/0_Aa_93_JPG.rf.776c7121bb3e9e5e3c92e54ee2ac3eb2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..26ca7d046d4588630490f4b07a082cb8e54c9f1b Binary files /dev/null and b/data/0_Aa_93_JPG.rf.776c7121bb3e9e5e3c92e54ee2ac3eb2.jpg differ diff --git a/data/0_Aa_96_JPG.rf.44e667262566218641dcf9bf16c9a420.jpg b/data/0_Aa_96_JPG.rf.44e667262566218641dcf9bf16c9a420.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f94d87ad33e123f3b15742aff1442742e0b13460 Binary files /dev/null and b/data/0_Aa_96_JPG.rf.44e667262566218641dcf9bf16c9a420.jpg differ diff --git a/data/1_As_100_JPG.rf.c908d4b98721957cc709109414082a0a.jpg b/data/1_As_100_JPG.rf.c908d4b98721957cc709109414082a0a.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c7d6261bbd3f4030205e9e7a2fd0bd941c52b4dc Binary files /dev/null and b/data/1_As_100_JPG.rf.c908d4b98721957cc709109414082a0a.jpg differ diff --git a/data/1_As_111_JPG.rf.0cc42bb5394c2f747781d83b94fac4da.jpg b/data/1_As_111_JPG.rf.0cc42bb5394c2f747781d83b94fac4da.jpg new file mode 100644 index 0000000000000000000000000000000000000000..77125f7fa27d1173fbbedbb71f4b6adb97bfd3a6 Binary files /dev/null and b/data/1_As_111_JPG.rf.0cc42bb5394c2f747781d83b94fac4da.jpg differ diff --git a/data/1_As_128_JPG.rf.7eff19505b11b173f3ba5c4aba4ab458.jpg b/data/1_As_128_JPG.rf.7eff19505b11b173f3ba5c4aba4ab458.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7103e3d765d1e90942c40bb24d2b8514b0394a53 Binary files /dev/null and b/data/1_As_128_JPG.rf.7eff19505b11b173f3ba5c4aba4ab458.jpg differ diff --git a/data/1_As_145_JPG.rf.fc56435d4723954da9d6bb6d3c4faa92.jpg b/data/1_As_145_JPG.rf.fc56435d4723954da9d6bb6d3c4faa92.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7435e3c2109e16d2229d4ba9af906102cbbae9fc Binary files /dev/null and b/data/1_As_145_JPG.rf.fc56435d4723954da9d6bb6d3c4faa92.jpg differ diff --git a/data/1_As_153_JPG.rf.86a42c31727085ac98772242de796ca2.jpg b/data/1_As_153_JPG.rf.86a42c31727085ac98772242de796ca2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..24e0081d61949d27f993f6c004c7eff09dceee75 Binary files /dev/null and b/data/1_As_153_JPG.rf.86a42c31727085ac98772242de796ca2.jpg differ diff --git a/data/1_As_159_JPG.rf.93683c0db301aaa8b3e8655fbb756440.jpg b/data/1_As_159_JPG.rf.93683c0db301aaa8b3e8655fbb756440.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5fa4edd33b6e51e8969b79cfeee2b5d8d1a20ff7 Binary files /dev/null and b/data/1_As_159_JPG.rf.93683c0db301aaa8b3e8655fbb756440.jpg differ diff --git a/data/1_As_170_JPG.rf.907f9866172a14cfacaa68fcba935c67.jpg b/data/1_As_170_JPG.rf.907f9866172a14cfacaa68fcba935c67.jpg new file mode 100644 index 0000000000000000000000000000000000000000..05ca4f717397803ade7645b555f6a3d90b49768a Binary files /dev/null and b/data/1_As_170_JPG.rf.907f9866172a14cfacaa68fcba935c67.jpg differ diff --git a/data/1_As_175_JPG.rf.d3d01e050df87c7a4d93118a37e6f788.jpg b/data/1_As_175_JPG.rf.d3d01e050df87c7a4d93118a37e6f788.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f67c353ea459c990b86c2a6e44770feb5f862247 Binary files /dev/null and b/data/1_As_175_JPG.rf.d3d01e050df87c7a4d93118a37e6f788.jpg differ diff --git a/data/1_As_187_JPG.rf.19db9c4e12c5dfe2c4838b15a5942d8f.jpg b/data/1_As_187_JPG.rf.19db9c4e12c5dfe2c4838b15a5942d8f.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0a47107dda5056bc20ac72f2688f1be7e03e60be Binary files /dev/null and b/data/1_As_187_JPG.rf.19db9c4e12c5dfe2c4838b15a5942d8f.jpg differ diff --git a/data/1_As_191_JPG.rf.6864f873c4efad60c346dd4a4e85846b.jpg b/data/1_As_191_JPG.rf.6864f873c4efad60c346dd4a4e85846b.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9e930600bdc28920acb66d348015acf222087c0d Binary files /dev/null and b/data/1_As_191_JPG.rf.6864f873c4efad60c346dd4a4e85846b.jpg differ diff --git a/data/1_Av_113_JPG.rf.30d1a6e4281372c0ed65a0edc3e21eaf.jpg b/data/1_Av_113_JPG.rf.30d1a6e4281372c0ed65a0edc3e21eaf.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d12f2c22be517d4c13640feccc02817f8e1db02f Binary files /dev/null and b/data/1_Av_113_JPG.rf.30d1a6e4281372c0ed65a0edc3e21eaf.jpg differ diff --git a/data/1_Av_119_JPG.rf.5316b513fa8d5912c336f9ba228e52ec.jpg b/data/1_Av_119_JPG.rf.5316b513fa8d5912c336f9ba228e52ec.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6e96f7eb6d2274b9cf13f0b817daa355c5c000cb Binary files /dev/null and b/data/1_Av_119_JPG.rf.5316b513fa8d5912c336f9ba228e52ec.jpg differ diff --git a/data/1_Av_128_JPG.rf.fbdcfe11c7c1d165012a75070bf00fcc.jpg b/data/1_Av_128_JPG.rf.fbdcfe11c7c1d165012a75070bf00fcc.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c9540cbbfe60c7e21e8f55b635cc3ab16c968b95 Binary files /dev/null and b/data/1_Av_128_JPG.rf.fbdcfe11c7c1d165012a75070bf00fcc.jpg differ diff --git a/data/1_Av_129_JPG.rf.a1e207a8f8e2b37b0f98cf0bfbab51fc.jpg b/data/1_Av_129_JPG.rf.a1e207a8f8e2b37b0f98cf0bfbab51fc.jpg new file mode 100644 index 0000000000000000000000000000000000000000..328c1c1c78d4b80b4a7383af72e484739e71dd5c Binary files /dev/null and b/data/1_Av_129_JPG.rf.a1e207a8f8e2b37b0f98cf0bfbab51fc.jpg differ diff --git a/data/1_Av_141_JPG.rf.610594d3f4d11aadcfb21e9e4c6f7932.jpg b/data/1_Av_141_JPG.rf.610594d3f4d11aadcfb21e9e4c6f7932.jpg new file mode 100644 index 0000000000000000000000000000000000000000..217dab4dc5934940fe48475853a2adaa93b68e52 Binary files /dev/null and b/data/1_Av_141_JPG.rf.610594d3f4d11aadcfb21e9e4c6f7932.jpg differ diff --git a/data/1_Av_142_JPG.rf.b2e4a2c58633e210afc85ce9e506a38f.jpg b/data/1_Av_142_JPG.rf.b2e4a2c58633e210afc85ce9e506a38f.jpg new file mode 100644 index 0000000000000000000000000000000000000000..26ec60ca54b3f70213848defd12263374f9f2cc3 Binary files /dev/null and b/data/1_Av_142_JPG.rf.b2e4a2c58633e210afc85ce9e506a38f.jpg differ diff --git a/data/1_Av_147_JPG.rf.f65a323de766b85b40dd4f16d244d259.jpg b/data/1_Av_147_JPG.rf.f65a323de766b85b40dd4f16d244d259.jpg new file mode 100644 index 0000000000000000000000000000000000000000..60d60784449e22d69fc4be7690fa1ac8ed81203f Binary files /dev/null and b/data/1_Av_147_JPG.rf.f65a323de766b85b40dd4f16d244d259.jpg differ diff --git a/data/1_Av_149_JPG.rf.a61e1058e1c88c84f03936e411d01c4c.jpg b/data/1_Av_149_JPG.rf.a61e1058e1c88c84f03936e411d01c4c.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f2b082d810dbf95ffb7f4c13241b7d9ef16f5ee8 Binary files /dev/null and b/data/1_Av_149_JPG.rf.a61e1058e1c88c84f03936e411d01c4c.jpg differ diff --git a/data/1_Av_160_JPG.rf.00217ec933117fe19fab33e696145995.jpg b/data/1_Av_160_JPG.rf.00217ec933117fe19fab33e696145995.jpg new file mode 100644 index 0000000000000000000000000000000000000000..017f79cb7aed758759e482cca8e0504c7d2345d0 Binary files /dev/null and b/data/1_Av_160_JPG.rf.00217ec933117fe19fab33e696145995.jpg differ diff --git a/data/1_Av_162_JPG.rf.81350d0f6f492caf485aae639e0d7894.jpg b/data/1_Av_162_JPG.rf.81350d0f6f492caf485aae639e0d7894.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f0a9af7d6742ed749a20ec100353096b399a661c Binary files /dev/null and b/data/1_Av_162_JPG.rf.81350d0f6f492caf485aae639e0d7894.jpg differ diff --git a/data/1_Cp_116_JPG.rf.3d5defa27cec3817a427787bd6946009.jpg b/data/1_Cp_116_JPG.rf.3d5defa27cec3817a427787bd6946009.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7f4f8fbbd67a28deb471c1759f8e39ab451e138b Binary files /dev/null and b/data/1_Cp_116_JPG.rf.3d5defa27cec3817a427787bd6946009.jpg differ diff --git a/data/1_Cp_118_JPG.rf.b01b83348c3b48aafbdd7afdaa1e409a.jpg b/data/1_Cp_118_JPG.rf.b01b83348c3b48aafbdd7afdaa1e409a.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5e338619e547be4fa70def2e2b36e39fadebbab5 Binary files /dev/null and b/data/1_Cp_118_JPG.rf.b01b83348c3b48aafbdd7afdaa1e409a.jpg differ diff --git a/data/1_Cp_124_JPG.rf.0477f886d2fca22fec28898d4450fee6.jpg b/data/1_Cp_124_JPG.rf.0477f886d2fca22fec28898d4450fee6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9e57abd8a8fa4c4bf68bd86b2c7e104ab35bdd88 Binary files /dev/null and b/data/1_Cp_124_JPG.rf.0477f886d2fca22fec28898d4450fee6.jpg differ diff --git a/data/1_Cp_129_JPG.rf.aaeac5447736cd42ed79e7edc64dbd5c.jpg b/data/1_Cp_129_JPG.rf.aaeac5447736cd42ed79e7edc64dbd5c.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7fe15ca5146f5028b366fe9954aead88101c9721 Binary files /dev/null and b/data/1_Cp_129_JPG.rf.aaeac5447736cd42ed79e7edc64dbd5c.jpg differ diff --git a/data/1_Cp_134_JPG.rf.dea8648f63065ac0fbc3562f89270362.jpg b/data/1_Cp_134_JPG.rf.dea8648f63065ac0fbc3562f89270362.jpg new file mode 100644 index 0000000000000000000000000000000000000000..19aa6be8102c85df9f076f9b9b4ae56e80638e96 Binary files /dev/null and b/data/1_Cp_134_JPG.rf.dea8648f63065ac0fbc3562f89270362.jpg differ diff --git a/data/1_Cp_41_JPG.rf.a08868e45a4a3ce46f66ef97fc8f088e.jpg b/data/1_Cp_41_JPG.rf.a08868e45a4a3ce46f66ef97fc8f088e.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c4e5593781c8770da928aaa9d038fc53b0954e53 Binary files /dev/null and b/data/1_Cp_41_JPG.rf.a08868e45a4a3ce46f66ef97fc8f088e.jpg differ diff --git a/data/1_Cp_42_JPG.rf.44b42b8b20a2626290204a5f010d2ba1.jpg b/data/1_Cp_42_JPG.rf.44b42b8b20a2626290204a5f010d2ba1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2219a3a25c13538b5aafbca610fcd4abd5306e01 Binary files /dev/null and b/data/1_Cp_42_JPG.rf.44b42b8b20a2626290204a5f010d2ba1.jpg differ diff --git a/data/1_Cp_48_JPG.rf.a822c15f648df2495c62085146b0af7a.jpg b/data/1_Cp_48_JPG.rf.a822c15f648df2495c62085146b0af7a.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6574bd7f0db4b58f3929da9cde56475e1a207a09 Binary files /dev/null and b/data/1_Cp_48_JPG.rf.a822c15f648df2495c62085146b0af7a.jpg differ diff --git a/data/1_Cp_57_JPG.rf.735d8ffb7d8d63709086fd8cdff58252.jpg b/data/1_Cp_57_JPG.rf.735d8ffb7d8d63709086fd8cdff58252.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bcebed944cd380e81874b211787cf63e81466fa2 Binary files /dev/null and b/data/1_Cp_57_JPG.rf.735d8ffb7d8d63709086fd8cdff58252.jpg differ diff --git a/data/1_Cp_74_JPG.rf.1a413cf8163ec22c05f3e856e1cf9f3a.jpg b/data/1_Cp_74_JPG.rf.1a413cf8163ec22c05f3e856e1cf9f3a.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6cca6a304b82410da5f7372a969633873e3382cc Binary files /dev/null and b/data/1_Cp_74_JPG.rf.1a413cf8163ec22c05f3e856e1cf9f3a.jpg differ diff --git a/data/1_Ct_103_JPG.rf.67e5012299b6c0d8bea7c81c4aec0319.jpg b/data/1_Ct_103_JPG.rf.67e5012299b6c0d8bea7c81c4aec0319.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5ed0755b78d2765a2d024acdf70233dc01c1762a Binary files /dev/null and b/data/1_Ct_103_JPG.rf.67e5012299b6c0d8bea7c81c4aec0319.jpg differ diff --git a/data/1_Ct_115_JPG.rf.2e269c068ab46e4bab0a66c851b4f7a0.jpg b/data/1_Ct_115_JPG.rf.2e269c068ab46e4bab0a66c851b4f7a0.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d931e44da3122d89fe06b063afcc72ce62ef1e10 Binary files /dev/null and b/data/1_Ct_115_JPG.rf.2e269c068ab46e4bab0a66c851b4f7a0.jpg differ diff --git a/data/1_Ct_139_JPG.rf.1cae44690c78f67be3701501ffef9e6a.jpg b/data/1_Ct_139_JPG.rf.1cae44690c78f67be3701501ffef9e6a.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d7a91d63fb4ce6d2c75a1d57a1044f635421c6f1 Binary files /dev/null and b/data/1_Ct_139_JPG.rf.1cae44690c78f67be3701501ffef9e6a.jpg differ diff --git a/data/1_Ct_143_JPG.rf.c256b5321cff786a325a4d5498f2ebf3.jpg b/data/1_Ct_143_JPG.rf.c256b5321cff786a325a4d5498f2ebf3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ef250b8d18ea21208abb4eef5653d7a009f39832 Binary files /dev/null and b/data/1_Ct_143_JPG.rf.c256b5321cff786a325a4d5498f2ebf3.jpg differ diff --git a/data/1_Ct_174_JPG.rf.5517105e559c29e57da2a81ea1cffbc5.jpg b/data/1_Ct_174_JPG.rf.5517105e559c29e57da2a81ea1cffbc5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1edc43c8b4f5203078d20a83b95d08912e7cb8e8 Binary files /dev/null and b/data/1_Ct_174_JPG.rf.5517105e559c29e57da2a81ea1cffbc5.jpg differ diff --git a/data/1_Ct_177_JPG.rf.a0dc4cae5aa12336fb9c018d58746d7f.jpg b/data/1_Ct_177_JPG.rf.a0dc4cae5aa12336fb9c018d58746d7f.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6a5725edca42e0ebeef8e0004a9150456bcff0b1 Binary files /dev/null and b/data/1_Ct_177_JPG.rf.a0dc4cae5aa12336fb9c018d58746d7f.jpg differ diff --git a/data/1_Ct_191_JPG.rf.28df7a42d9f4efb4e76d23738a896b4f.jpg b/data/1_Ct_191_JPG.rf.28df7a42d9f4efb4e76d23738a896b4f.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1c3c56fee061add932070b151f8a34339aa3d281 Binary files /dev/null and b/data/1_Ct_191_JPG.rf.28df7a42d9f4efb4e76d23738a896b4f.jpg differ diff --git a/data/1_Ct_55_JPG.rf.ee10c0595c079a98d8608cbb4e70341e.jpg b/data/1_Ct_55_JPG.rf.ee10c0595c079a98d8608cbb4e70341e.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8916a2b9b1172bb8fd92f2ca502e5a98ce27cc3a Binary files /dev/null and b/data/1_Ct_55_JPG.rf.ee10c0595c079a98d8608cbb4e70341e.jpg differ diff --git a/data/1_Ct_64_JPG.rf.ba4dc79ea34bdc2b68df116caf9ce4a5.jpg b/data/1_Ct_64_JPG.rf.ba4dc79ea34bdc2b68df116caf9ce4a5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..169019716075846048e97acde55e3f0cb55acf0f Binary files /dev/null and b/data/1_Ct_64_JPG.rf.ba4dc79ea34bdc2b68df116caf9ce4a5.jpg differ diff --git a/data/1_Ct_68_JPG.rf.93964ce6061ccacb7d8f752fed0877c0.jpg b/data/1_Ct_68_JPG.rf.93964ce6061ccacb7d8f752fed0877c0.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bae752ed8a787f5f049aa663a75abb5ab7056152 Binary files /dev/null and b/data/1_Ct_68_JPG.rf.93964ce6061ccacb7d8f752fed0877c0.jpg differ diff --git a/data/true_labels.pkl b/data/true_labels.pkl new file mode 100644 index 0000000000000000000000000000000000000000..6f5bfaf60b4948623cfe94cc678ff29e93ea7d1f --- /dev/null +++ b/data/true_labels.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c177373956e087f14d984db7eb5bc37f9bd6315eda9c4c88bda0944013d3a40 +size 2935 diff --git a/main.py b/main.py new file mode 100644 index 0000000000000000000000000000000000000000..8b9ccb7bfe7fbf5aac2aa2fa57b1bc7461383402 --- /dev/null +++ b/main.py @@ -0,0 +1,51 @@ +from typing import Optional + +from fastapi import APIRouter +from fastapi import FastAPI +from schemas import ClassificationResult +from utils import load_image +from utils import load_model + + +# from pydantic import BaseModel + +model = load_model() + +app = FastAPI( + title="MosAl", + openapi_url="/openapi.json", + description="""Obtain classification predictions for mosquito image""", + version="0.1.0", +) + +api_router = APIRouter() + + +@api_router.get("/", status_code=200) +async def root(): + """ + Root Get + """ + return {"message": "Hello World!"} + + +@api_router.get("/classify/{image_name}", status_code=200, response_model=ClassificationResult) +async def predict_image(image_name, model=model): + img = load_image(image_name) + prediction, pred_idx, probs = model.predict(img) + if prediction: + return {"prediction": prediction, + "score": round(probs.numpy()[pred_idx], 3), + } + else: + return {"message": [0]} + + + +app.include_router(api_router) + +if __name__ == "__main__": + # Use this for debugging purposes only 0.0.0.0 localhost 8001 + import uvicorn + + uvicorn.run(app, host="0.0.0.0", port=7860, log_level="debug") diff --git a/models/vit_tiny_patch16_224_2.pkl b/models/vit_tiny_patch16_224_2.pkl new file mode 100644 index 0000000000000000000000000000000000000000..3e2a0e470d7e1b890a2dbf9d562b2c6cd0ebacad --- /dev/null +++ b/models/vit_tiny_patch16_224_2.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4331906641cec9f31a272251b731aa21f3bb80b39be0ec7456d7291268f758fb +size 22787075 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..0333c3c786d1485a923e6237776b75241502c100 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +timm==0.9.12 +fastai==2.7.13 \ No newline at end of file diff --git a/schemas.py b/schemas.py new file mode 100644 index 0000000000000000000000000000000000000000..9fe9fbfba19934d7e17c9051bbfda17a450d8e5a --- /dev/null +++ b/schemas.py @@ -0,0 +1,6 @@ +from typing import List +from pydantic import BaseModel + +class ClassificationResult(BaseModel): + prediction: str + score: float diff --git a/utils.py b/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..d13e5124f61a118a42fc83b4a58d06dd270c360e --- /dev/null +++ b/utils.py @@ -0,0 +1,34 @@ +from huggingface_hub import hf_hub_download +from fastai.vision.all import * +from fastai.learner import load_learner +import os +import os.path as op +import pickle + + +from contextlib import contextmanager +import pathlib + +@contextmanager +def set_posix_windows(): + posix_backup = pathlib.PosixPath + try: + pathlib.PosixPath = pathlib.WindowsPath + yield + finally: + pathlib.PosixPath = posix_backup + +HOME_DIR = os.getcwd() +DATA_DIR = op.join(HOME_DIR, 'data') +MODELS_DIR = op.join(HOME_DIR,'models') + + +def load_model(): + with set_posix_windows(): + learn = load_learner(op.join(MODELS_DIR, "vit_tiny_patch16_224_2.pkl")) + return learn + +# learn = load_learner(op.join(MODELS_DIR, "vit_tiny_patch16_224_2.pkl")) +def load_image(image_name): + img = op.join(DATA_DIR, image_name) + return img