title | description |
---|---|
Deployment Model Inference |
A description of the project. |
This project demonstrates a Dockerized inference pipeline for deploying a machine learning model. The pipeline loads a trained model, preprocesses input data, and makes predictions using the model.
The project consists of the following components:
src/inference.py
: The main script that loads the model, preprocesses input data, and makes predictions.src/model_loader.py
: A utility script to load the trained model.src/data_preprocessor.py
: A utility script to preprocess input data.models/trained_model_2025-01-02.joblib
: A trained model saved in themodels/
directory.Dockerfile
: A Dockerfile to containerize the inference pipeline.pyproject.toml
: A Poetry configuration file for dependency management.
Before running the project, ensure you have the following installed:
- Docker: Install Docker
- Poetry: Install Poetry
-
Clone the repository:
git clone https://github.com/iair/deployment_model_inference.git cd deployment_model_inference
-
Install dependencies using Poetry:
poetry install
-
Activate the Poetry virtual environment:
poetry shell
-
Run the inference script:
poetry run python src/inference.py
The script expects input data in the following format:
input_data = {
"Pregnancies": 6,
"Glucose": 148,
"BloodPressure": 72,
"SkinThickness": 0,
"Insulin": 0,
"BMI": 33.6,
"DiabetesPedigreeFunction": 0.627,
"Age": 50
}
To build the Docker image, run:
docker build -t deployment_model_inference .
To run the container and execute the inference script:
docker run -it deployment_model_inference:latest
If you want to test changes to your code or model without rebuilding the Docker image, mount your local project directory into the container:
docker run -it -v $(pwd):/app deployment_model_inference:latest
To test the inference pipeline, ensure the model file (models/trained_model_2025-01-02.joblib
) exists and is correctly loaded. You can also test with different input data to verify the pipeline's robustness.
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeatureName
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeatureName
). - Open a pull request.
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
- Thanks to the open-source community for providing tools and libraries that made this project possible.
- Special thanks to Poetry and Docker for simplifying dependency management and deployment.
For questions or feedback, feel free to reach out:
- Author: Iair
- Email: [email protected]
- GitHub: iair
- Open your project in Visual Studio Code.
- Open the
README.md
file (or create one if it doesn’t exist). - Copy and paste the above content into the file.
- Save the file (
Ctrl + S
orCmd + S
).