{"id":24989813,"url":"https://github.com/clementsan/iris_classification_lambda","last_synced_at":"2026-04-13T21:04:19.882Z","repository":{"id":267714920,"uuid":"902129994","full_name":"clementsan/iris_classification_lambda","owner":"clementsan","description":"IRIS classification using AWS Lambda","archived":false,"fork":false,"pushed_at":"2025-01-10T18:38:05.000Z","size":51,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T13:03:31.708Z","etag":null,"topics":["ai","aws","aws-lambda","classification","gradio","huggingface","huggingface-spaces","machine-learning","scikit-learn"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clementsan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-12-12T00:55:35.000Z","updated_at":"2025-01-10T18:38:08.000Z","dependencies_parsed_at":"2024-12-12T02:22:03.863Z","dependency_job_id":"320d50de-6bf6-48fa-b7b1-4ad2138d0e7d","html_url":"https://github.com/clementsan/iris_classification_lambda","commit_stats":null,"previous_names":["clementsan/iris_classification_lambda"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clementsan%2Firis_classification_lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clementsan%2Firis_classification_lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clementsan%2Firis_classification_lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clementsan%2Firis_classification_lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clementsan","download_url":"https://codeload.github.com/clementsan/iris_classification_lambda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246180923,"owners_count":20736460,"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":["ai","aws","aws-lambda","classification","gradio","huggingface","huggingface-spaces","machine-learning","scikit-learn"],"created_at":"2025-02-04T13:03:34.930Z","updated_at":"2026-04-13T21:04:19.851Z","avatar_url":"https://github.com/clementsan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: IRIS Classification Lambda\nemoji: 🏢\ncolorFrom: indigo\ncolorTo: blue\nsdk: gradio\nsdk_version: 5.5.0\napp_file: app.py\npinned: false\nshort_description: IRIS Classification Lambda\n---\n\n# IRIS classification task with AWS Lambda\n\n[![](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)\n[![Docker Pulls](https://img.shields.io/docker/pulls/cvachet/iris-classification-lambda)](https://hub.docker.com/repository/docker/cvachet/iris-classification-lambda)\n[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n\n![example workflow](https://github.com/clementsan/iris_classification_lambda/actions/workflows/ci_python.yml/badge.svg)\n![example workflow](https://github.com/clementsan/iris_classification_lambda/actions/workflows/publish_docker_image.yml/badge.svg)\n![example workflow](https://github.com/clementsan/iris_classification_lambda/actions/workflows/sync_HFSpace.yml/badge.svg)\n\n**Aims:** Categorization of different species of iris flowers (Setosa, Versicolor, and Virginica)\n            based on measurements of physical characteristics (sepals and petals).\n\n**Method:** Use of Decision Tree Classifier\n\n**Architecture:**\n - Front-end: user interface via Gradio library\n - Back-end: use of AWS Lambda function to run deployed ML model\n\nYou can try out our deployed [Hugging Face Space](https://huggingface.co/spaces/cvachet/iris_classification_lambda\n)!\n\n----\n**Table of contents:**\n - [Local development](#1-local-development)\n - [AWS deployment](#2-deployment-to-aws)\n - [Hugging Face deployment](#3-deployment-to-hugging-face)\n - [Docker Hub deployment](#4-deployment-to-docker-hub)\n----\n\n## 1. Local development\n\n### 1.1 Training the ML model\n\nbash\n\u003e python train.py\n\n### 1.2. Docker container\n\n - Building the docker image\n\nbash\n\u003e docker build -t iris-classification-lambda .\n\n - Running the docker container\n\nbash\n\n\u003e docker run --name iris-classification-lambda-cont -p 8080:8080 iris-classification-lambda\n\n\n### 1.3. Execution via command line\n\nExample of a prediction request\n\nbash\n\u003e curl -X POST \"http://localhost:8080/2015-03-31/functions/function/invocations\" -H \"Content-Type: application/json\" -d '{\"features\": [[6.5, 3.0, 5.8, 2.2], [6.1, 2.8, 4.7, 1.2]]}'\n\npython\n\u003e python3 inference_api.py --url http://localhost:8080/2015-03-31/functions/function/invocations -d '{\"features\": [[6.5, 3.0, 5.8, 2.2], [6.1, 2.8, 4.7, 1.2]]}'\n\n\n### 1.4. Execution via user interface\n\nUse of Gradio library for web interface\n\n**Note:** The environment variable ```AWS_API``` should point to the local container\n\u003e export AWS_API=http://localhost:8080\n\nCommand line for execution:\n\u003e python3 app.py\n\nThe Gradio web application should now be accessible at http://localhost:7860\n\n\n## 2. Deployment to AWS\n\n### 2.1. Pushing the docker container to AWS ECR\n\n\u003cdetails\u003e\n\nSteps:\n - Create new ECR Repository via aws console\n\nExample: ```iris-classification-lambda```\n\n\n - Optional for aws cli configuration (to run above commands):\n\u003e aws configure\n\n - Authenticate Docker client to the Amazon ECR registry\n\u003e aws ecr get-login-password --region \u003caws_region\u003e | docker login --username AWS --password-stdin \u003caws_account_id\u003e.dkr.ecr.\u003caws_region\u003e.amazonaws.com\n\n - Tag local docker image with the Amazon ECR registry and repository\n\u003e docker tag iris-classification-lambda:latest \u003caws_account_id\u003e.dkr.ecr.\u003caws_region\u003e.amazonaws.com/iris-classification-lambda:latest\n\n - Push docker image to ECR\n\u003e docker push \u003caws_account_id\u003e.dkr.ecr.\u003caws_region\u003e.amazonaws.com/iris-classification-lambda:latest\n\n\u003c/details\u003e\n\n[Link to AWS ECR Documention](https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-push-ecr-image.html)\n\n### 2.2. Creating and testing a Lambda function\n\n\u003cdetails\u003e\n\n**Steps**:\n - Create function from container image\n\nExample name: ```iris-classification```\n\n - Notes: the API endpoint will use the ```lambda_function.py``` file and ```lambda_hander``` function\n - Test the lambda via the AWS console\n\nExample JSON object:\n```\n{\n    \"features\": [[6.5, 3.0, 5.8, 2.2], [6.1, 2.8, 4.7, 1.2]]\n}\n```\n\nAdvanced notes:\n - Steps to update the Lambda function with latest container via aws cli:\n\u003e aws lambda update-function-code --function-name iris-classification --image-uri \u003caws_account_id\u003e.dkr.ecr.\u003caws_region\u003e.amazonaws.com/iris-classification-lambda:latest\n\n\u003c/details\u003e\n\n### 2.3. Creating an API via API Gateway\n\n\u003cdetails\u003e\n\n**Steps**:\n - Create a new ```Rest API``` (e.g. ```iris-classification-api```)\n - Add a new resource to the API (e.g. ```/classify```)\n - Add a ```POST``` method to the resource\n - Integrate the Lambda function to the API\n   - Notes: using proxy integration option unchecked\n - Deploy API with a specific stage (e.g. ```test``` stage)\n\n\u003c/details\u003e\n\nExample AWS API Endpoint:\n```https://\u003capi_id\u003e.execute-api.\u003caws_region\u003e.amazonaws.com/test/classify```\n\n\n### 2.4. Execution for deployed model\n\nExample of a prediction request\n\nbash\n\u003e curl -X POST \"https://\u003capi_id\u003e.execute-api.\u003caws_region\u003e.amazonaws.com/test/classify\" -H \"Content-Type: application/json\" -d '{\"features\": [[6.5, 3.0, 5.8, 2.2], [6.1, 2.8, 4.7, 1.2]]}'\n\npython\n\u003e python3 inference_api.py --url https://\u003capi_id\u003e.execute-api.\u003caws_region\u003e.amazonaws.com/test/classify -d '{\"features\": [[6.5, 3.0, 5.8, 2.2], [6.1, 2.8, 4.7, 1.2]]}'\n\n\n## 3. Deployment to Hugging Face\n\nThis web application is available on Hugging Face\n\nHugging Face space URL:\nhttps://huggingface.co/spaces/cvachet/iris_classification_lambda\n\nNote: This space uses the ML model deployed on AWS Lambda\n\n\n## 4. Deployment to Docker Hub\n\nThis web application is available on Docker Hub as a docker image\n\nURL:\nhttps://hub.docker.com/r/cvachet/iris-classification-lambda\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclementsan%2Firis_classification_lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclementsan%2Firis_classification_lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclementsan%2Firis_classification_lambda/lists"}