{"id":18068439,"url":"https://github.com/lykourgoss/iris-ml-model-microservice","last_synced_at":"2026-04-16T14:02:25.196Z","repository":{"id":258659347,"uuid":"874362933","full_name":"LykourgosS/iris-ml-model-microservice","owner":"LykourgosS","description":"A FastAPI microservice for predicting iris species based on sepal and petal dimensions. This project leverages machine learning to classify iris flowers into their respective species. (mpsp)","archived":false,"fork":false,"pushed_at":"2024-10-23T11:44:33.000Z","size":757,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T17:39:58.706Z","etag":null,"topics":["docker","fastapi","iris-classification","machine-learning-model","microservice"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LykourgosS.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":"2024-10-17T17:34:09.000Z","updated_at":"2024-10-23T11:44:37.000Z","dependencies_parsed_at":"2024-12-18T22:40:28.628Z","dependency_job_id":"15739c68-88ee-4da1-8c95-58354c3a3a55","html_url":"https://github.com/LykourgosS/iris-ml-model-microservice","commit_stats":null,"previous_names":["lykourgoss/iris-ml-model-microservice"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LykourgosS/iris-ml-model-microservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LykourgosS%2Firis-ml-model-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LykourgosS%2Firis-ml-model-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LykourgosS%2Firis-ml-model-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LykourgosS%2Firis-ml-model-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LykourgosS","download_url":"https://codeload.github.com/LykourgosS/iris-ml-model-microservice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LykourgosS%2Firis-ml-model-microservice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31888935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T11:36:10.202Z","status":"ssl_error","status_checked_at":"2026-04-16T11:36:09.652Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["docker","fastapi","iris-classification","machine-learning-model","microservice"],"created_at":"2024-10-31T08:06:28.639Z","updated_at":"2026-04-16T14:02:25.157Z","avatar_url":"https://github.com/LykourgosS.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Iris Machine Learning Model Microservice\n\n![FastAPI](https://img.shields.io/badge/FastAPI-109989?logo=FastAPI\u0026logoColor=white)\n![Docker](https://img.shields.io/badge/Docker-2CA5E0?logo=docker\u0026logoColor=white)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-FE5196?logo=conventionalcommits\u0026logoColor=white)](https://conventionalcommits.org)\n\nA FastAPI microservice for predicting iris species based on sepal and petal dimensions. This project leverages machine learning to classify iris flowers into their respective species.\n\n![Iris Dataset](docs/images/iris-dataset.png \"Iris Dataset\")\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [API Endpoints](#api-endpoints)\n- [Example Request and Response](#example-request-and-response)\n- [Dependencies](#dependencies)\n- [License](#license)\n- [Attribution](#attribution)\n\n## Installation\n\nTo set up the project locally, you can choose between two methods: using Docker or a Python virtual environment.\n\n### Method 1: Using Docker\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/LykourgosS/iris-ml-model-microservice.git\n   cd iris-ml-model-microservice\n   ```\n\n2. Build the Docker image:\n\n   ```bash\n   docker build -t iris-ml-model-microservice .\n   ```\n\n3. Run the Docker container:\n   ```bash\n   docker run -d -p 8000:8000 iris-ml-model-microservice\n   ```\n\nThis will start the server at `http://localhost:8000`. You can then access the API documentation at `http://localhost:8000/docs`.\n\n### Method 2: Using Virtual Environment\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/LykourgosS/iris-ml-model-microservice.git\n   cd iris-ml-model-microservice\n   ```\n\n2. Create a virtual environment (optional but recommended):\n\n   ```bash\n   python -m venv venv\n   source venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n   ```\n\n3. Install the required dependencies:\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. Train the model and save it as LRClassifier.pkl:\n\n   ```bash\n   python .\\app\\generate-model.py\n   ```\n\n5. Start the FastAPI server:\n   ```bash\n   uvicorn app.main:app --reload\n   ```\n\nThis will also start the server at `http://localhost:8000`, and you can access the API documentation at `http://localhost:8000/docs`.\n\n## Usage\n\nOnce the server is running (via Docker or virtual environment), you can interact with the API at `http://localhost:8000`, as mentioned above.\n\n## API Endpoints\n\n### Predict Iris Species\n\n- **Endpoint:** `/predict`\n- **Method:** `POST`\n- **Request Body:**\n\n  ```json\n  {\n      \"sepal_length\": \u003cfloat\u003e,\n      \"sepal_width\": \u003cfloat\u003e,\n      \"petal_length\": \u003cfloat\u003e,\n      \"petal_width\": \u003cfloat\u003e\n  }\n  ```\n\n- **Response:**\n  ```json\n  {\n      \"prediction\": \u003cstring\u003e,\n      \"probability\": \u003cfloat\u003e\n  }\n  ```\n\n## Example Request and Response\n\nHere's an example of how to make a request to the `/predict` endpoint:\n\n### Request\n\n- **Using** `curl`:\n\n```bash\ncurl -X POST \"http://localhost:8000/predict\" -H \"Content-Type: application/json\" -d '{\n    \"sepal_length\": 5.1,\n    \"sepal_width\": 3.5,\n    \"petal_length\": 1.4,\n    \"petal_width\": 0.2\n}'\n```\n\n- **Using** `python`:\n\n```python\nimport requests\nnew_measurement = {\n    \"sepal_length\": 5.1,\n    \"sepal_width\": 3.5,\n    \"petal_length\": 1.4,\n    \"petal_width\": 0.2\n}\nresponse = requests.post('http://127.0.0.1:8000/predict', json=new_measurement)\nprint(response.content)\n```\n\n### Response\n\nAnd here is the response:\n\n```json\n{\n  \"prediction\": \"Iris-setosa\",\n  \"probability\": 0.9793734738197287\n}\n```\n\n![Iris Setosa predicted with probability ≈ 0.98](docs/images/iris-setosa-predicted.png \"Iris Setosa predicted with probability ≈ 0.98\")\n\n## Dependencies\n\nThis project requires the following Python packages:\n\n- pandas\n- numpy\n- pickle\n- scikit-learn\n- FastAPI\n- Uvicorn\n\nYou can find the complete list of dependencies with their versions in the [requirements.txt](/requirements.txt) file.\n\n\u003e [!NOTE]\n\u003e Pickle module is a Python built-in module, meaning there is no need to install it separately.\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.\n\n## Attribution\n\nThis project is based on the following blog post:\n\n- [How to deploy machine learning models as a microservice using fastapi](https://ashutoshtripathi.com/2021/02/15/how-to-deploy-machine-learning-models-as-a-microservice-using-fastapi/) by [Ashutosh Tripathi](https://ashutoshtripathi.com/author/ashutoshtripathi19/)\n\nSpecial thanks to the author for their guide on deploying a machine learning model as a microservice.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykourgoss%2Firis-ml-model-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flykourgoss%2Firis-ml-model-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykourgoss%2Firis-ml-model-microservice/lists"}