{"id":25239669,"url":"https://github.com/stevekirks/py-imageclassification","last_synced_at":"2025-04-05T19:44:26.679Z","repository":{"id":272999518,"uuid":"918421647","full_name":"stevekirks/py-imageclassification","owner":"stevekirks","description":"A web api that uses the CLIP model and a list of categories to classify images.","archived":false,"fork":false,"pushed_at":"2025-01-27T02:41:56.000Z","size":215,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T18:45:43.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stevekirks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-17T22:38:39.000Z","updated_at":"2025-01-27T02:42:00.000Z","dependencies_parsed_at":"2025-02-11T18:44:18.263Z","dependency_job_id":null,"html_url":"https://github.com/stevekirks/py-imageclassification","commit_stats":null,"previous_names":["stevekirks/py-imageclassification"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevekirks%2Fpy-imageclassification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevekirks%2Fpy-imageclassification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevekirks%2Fpy-imageclassification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevekirks%2Fpy-imageclassification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stevekirks","download_url":"https://codeload.github.com/stevekirks/py-imageclassification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393540,"owners_count":20931810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-11T18:29:52.874Z","updated_at":"2025-04-05T19:44:26.663Z","avatar_url":"https://github.com/stevekirks.png","language":"Python","readme":"# Image Classification API\n\nA web api that uses the [CLIP](https://github.com/openai/CLIP) model and a list of categories (see `app/image_service.py`) to classify images.\n\nIt runs in a docker container with a volume for the model. This has been tested to run in an Azure Web App for Containers (linux) and performance is decent (500kb images \u003c 0.4sec) on P0v3 (195 ACU/vCPU, 1vCPU, 4GB memory, AUD$73).\n\n## Usage\n\n### Local development with Dev Containers\nFor local development, you can use Docker and DevContainers in VS Code (requires the [Dev Containers VSCode extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)).\n\nWith Docker running, clone the repo, open vscode, and if doesn't already prompt you, run the `Dev Containers: Reopen in Container` command.\n\nAlternatively, you can setup a python virtual environment and install the packages in `requirements.txt`.\n\n### Download the CLIP model\nBefore running the tests or web api, download the model. Run the python script `save_model_locally.py` to download the CLIP model to the ./data folder.\n\n### Tests\nThere's some tests using `pytest`. See `tests/test_model.py`.\n\n### To run in Docker without an IDE\n```powershell\ndocker build --tag imgdet:latest .\ndocker run --rm -p 8080:80 -v my_repo_location/data:/volume imgdet\n```\n\n### Jupyter Notebooks\nThere's a jupyter notebook, `tests/analyse.ipynb`, that can be used for testing the web api.\n\n### Azure\nFor deployment to an Azure Web App for Containers, these az cli commands can help:\n\nBuild image and push to container registry:\n```powershell\naz acr build --registry myregistry --image myregistry.azurecr.io/imgdet:latest .\n```\n\nGet web app to use latest container. Hacky (to avoid thinking about versions).\n```powershell\naz webapp config container set --name mywebapp --resource-group myresourcegroup --container-image-name myregistry.azurecr.io/imgdet:0.0.999\naz webapp config container set --name mywebapp --resource-group myresourcegroup --container-image-name myregistry.azurecr.io/imgdet:latest\n```\n\nThis isn't all the setup required for an Azure deployment. You'll also need to create an Azure File Storage resource, upload the model, and setup a `/volume` path in the web app pointing to it. Update the `model_path` in `main.py` to match.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevekirks%2Fpy-imageclassification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevekirks%2Fpy-imageclassification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevekirks%2Fpy-imageclassification/lists"}