ALYYAN/chest-cancer-classifier-app
<div align="center">
๐ฉบ End-to-End Chest Cancer Classification
An MLOps project demonstrating the complete lifecycle of a deep learning model, from data ingestion to CI/CD-powered deployment.
  
</div>
๐ Live Demo
Experience the deployed application live on Hugging Face Spaces!
[โก๏ธ Live Demo Link](https://huggingface.co/spaces/alyyan/chest-cancer-classifier-app)
(Note: The Space may be asleep if it hasn't been used recently. Please allow a moment for it to wake up.)
๐ผ๏ธ Application Screenshot
Here is the user interface of the deployed web application.
)
๐ About The Project
This project implements a complete end-to-end MLOps pipeline for a Chest Cancer image classification task. A deep learning model (based on VGG16/ResNet) is trained to distinguish between Normal and Adenocarcinoma chest CT scans.
The primary focus is not just on the model's accuracy, but on building a robust, reproducible, and automated system using modern MLOps tools.
Key Features:
- Experiment Tracking: Uses MLflow to log parameters, metrics, and model artifacts for every run.
- Data & Model Versioning: Uses DVC to version large data files and models, keeping the Git repository lightweight.
- Automated CI/CD: A GitHub Actions workflow automatically tests, builds, and deploys the application on every push to the
mainbranch. - Web Application: A user-friendly Flask application serves the trained model for real-time predictions.
- Containerization: The entire application is containerized with Docker for consistent and portable deployment.
- Cloud Deployment: Deployed for free on Hugging Face Spaces.
๐ ๏ธ Tech Stack
- Backend: Python, Flask
- Model: TensorFlow, Keras
- MLOps Tools: MLflow, DVC, Dagshub (for remote tracking)
- CI/CD & Deployment: Docker, GitHub Actions, Hugging Face Spaces
๐ MLOps Workflow
The project follows a structured MLOps workflow, which is fully automated by the CI/CD pipeline.
<pre><code class="language-mermaid"> graph TD A[Start: Push Code to GitHub] --> B{GitHub Actions CI/CD}; B --> C[CI: Install Dependencies & Run Tests]; C -->|Success| D[CD: Deploy to Hugging Face]; D --> E[๐ Live Application];
subgraph "DVC & MLflow Cycle (Local/Remote)" F[1. dvc repro] --> G[2. Pull Data (DVC)]; G --> H[3. Train Model]; H --> I[4. Log Metrics & Model (MLflow)]; I --> J[5. Push Model (DVC)]; end </code></pre>
โ๏ธ Getting Started - Local Setup
To run this project on your local machine, follow these steps.
Prerequisites
- Git
- Python 3.8+
- A DagsHub account (for MLflow tracking)
Installation & Setup
- Clone the repository:
git clone https://github.com/AlyyanAhmed21/End-to-End-Chest-Cancer-Classification-using-MLflow-and-DVC.git
cd End-to-End-Chest-Cancer-Classification-using-MLflow-and-DVC- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up MLflow/DagsHub credentials: Create a
.envfile in the root directory and add your credentials. This file is ignored by Git.
MLFLOW_TRACKING_URI="https://dagshub.com/YourUsername/YourRepoName.mlflow"
MLFLOW_TRACKING_USERNAME="YourUsername"
MLFLOW_TRACKING_PASSWORD="YourDagsHubAccessToken"- Run the DVC pipeline: This command will execute all stages defined in
dvc.yaml(data ingestion, model preparation, training, and evaluation).
dvc repro- Run the Flask application:
python app.py Open your browser and navigate to http://localhost:8080 to use the app.
๐ Project Structure
.
โโโ .dvc/ # DVC metadata
โโโ .github/workflows/ # GitHub Actions CI/CD pipeline
โโโ artifacts/ # (Generated by DVC) Data, models, etc.
โโโ config/ # Configuration files (config.yaml)
โโโ src/ # Source code for the project
โ โโโ cnnClassifier/
โ โโโ components/ # Individual pipeline components
โ โโโ config/ # Configuration management code
โ โโโ entity/ # Custom entity definitions
โ โโโ pipeline/ # DVC pipeline stage definitions
โ โโโ utils/ # Utility functions
โโโ templates/ # HTML templates for the Flask app
โโโ .gitignore
โโโ app.py # Main Flask application entrypoint
โโโ dvc.yaml # DVC pipeline definition
โโโ Dockerfile # Docker configuration for deployment
โโโ main.py # Main project orchestrator
โโโ params.yaml # Model parameters
โโโ requirements.txt # Python dependencies๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
<div align="center">
Star the repo if you found it useful! โญ
</div>
