https://mlops-kidney-disease-cnn.onrender.com
This application predicts whether an uploaded kidney CT scan image is Normal or Tumor.
This project is a full end-to-end MLOps implementation for kidney disease image classification, including:
- Data and pipeline versioning with DVC
- Experiment tracking with MLflow
- Deep learning training and inference using TensorFlow/Keras
- Flask web application for real-time predictions
- Dockerized application for consistent local container runs
- Python-based testing for CI validation
- GitHub Actions CI/CD pipeline
- Production deployment on Render using Deploy Hook
- Model type: CNN with transfer learning (VGG16 base)
- Input image size: 224 x 224
- Classes: Normal, Tumor
- Latest tracked metrics:
- Accuracy: 0.8561
- Loss: 0.2790
- Python 3.10
- TensorFlow / Keras
- Flask
- DVC
- MLflow
- Docker
- GitHub Actions
- Render
The workflow is organized into clear training and serving stages:
- Data Ingestion
- Base Model Preparation
- Model Training
- Model Evaluation
- Prediction Serving via Flask API and UI
Main implementation areas:
- src/cnnClassifier/components for training pipeline components
- src/cnnClassifier/pipeline for stage orchestration and prediction pipeline
- config/config.yaml for project-level paths and runtime settings
- params.yaml for model and training parameters
- app.py for web routes and inference endpoint
- templates/index.html for frontend UI
- Python 3.10
- Conda (recommended)
- Git
git clone https://github.com/Kallappa2005/MLOPS_KIDNEY_DISEASE_CNN
cd MLOPS_KIDNEY_DISEASE_CNN
conda create -n kidneyCnnenv python=3.10 -y
conda activate kidneyCnnenv
pip install -r requirements.txtpython main.pypython app.pyOpen the local URL shown in terminal and upload an image for prediction.
DVC is used to version data and pipeline outputs, making experiments reproducible.
Useful commands:
dvc init
dvc repro
dvc dag
dvc status
dvc metrics show
dvc add <path>
dvc push
dvc pull
dvc checkoutMLflow is used to log experiments, metrics, and model performance over runs.
Run MLflow UI locally:
mlflow uiOptional DagsHub integration example:
import dagshub
dagshub.init(
repo_owner="kallappakabbur874",
repo_name="MLOPS_KIDNEY_DISEASE_CNN",
mlflow=True
)This project includes a Dockerfile for containerized runs.
Build image:
docker build -t kidney-cnn:local .Run container:
docker run -d --name kidney-cnn -p 8080:8080 kidney-cnn:localStop and remove:
docker stop kidney-cnn
docker rm kidney-cnnCI currently runs smoke tests from tests/test_ci_smoke.py.
Run tests locally:
python -m unittest discover -s tests -p "test_*.py" -vWorkflow file:
- .github/workflows/ci-cd.yml
Current pipeline behavior:
- Trigger on push to main and pull request to main
- Setup Python and install requirements
- Run Python tests
- If event is push to main and tests pass, call Render Deploy Hook
Required GitHub secret:
- RENDER_DEPLOY_HOOK
Deployment strategy used in this project:
- Render source-based web service
- GitHub Actions triggers Render deployment using Deploy Hook after tests pass
Render setup steps:
- Create a new Render Web Service
- Connect this GitHub repository
- Set branch to main
- Configure start command as python app.py (or gunicorn app:app if configured)
- Ensure app binds to 0.0.0.0 and uses PORT
- Copy Deploy Hook URL from Render service settings
- Add the URL to GitHub secrets as RENDER_DEPLOY_HOOK
After this setup:
- Every push to main runs tests first
- If tests pass, CI triggers Render deploy hook
- Updated code is deployed to the live application
High-level folders and files:
- src for ML components, configs, entities, pipelines, and utilities
- config for central YAML configuration
- artifacts for generated datasets and models
- model for deployable model artifacts
- templates for frontend HTML
- tests for CI test cases
- app.py for Flask app and endpoints
- main.py for training pipeline execution
- Add unit tests for each pipeline component
- Add integration tests for predict endpoint
- Add model confidence score in UI response
- Add model registry and version promotion flow
- Add environment-specific deployment workflows