This is an end-to-end Machine Learning system that predicts loan approval status based on user input. The project simulates a real-world deployment pipeline, integrating model serving, user interface, API gateway, and monitoring stack — all containerized with Docker and orchestrated via GitHub Actions.
✅ Test-deployment structure
🔁 CI/CD tested via GitHub Actions
📊 Real-time monitoring with Prometheus + Grafana
Manual loan approval processes in financial institutions are often slow and inconsistent. This project demonstrates how machine learning can automate and standardize such decisions, backed by modern MLOps practices.
The goal is to:
- Automate loan approval decision-making
- Serve a model through a REST API
- Provide a friendly UI for interaction
- Monitor system performance and behavior
The raw dataset version was downloaded from this link. This project uses a preprocessed dataset of loan applicants, including features like:
- Age
- Income
- Loan amount
- Loan interest
- Loan percent income
- Credit score
- Previous loan default indicator
The target variable is a binary label indicating loan approval (1
= approved, 0
= rejected).
Layer | Tools |
---|---|
Model Training & Serving | MLflow |
API Gateway | Flask |
User Interface | Streamlit |
Monitoring | Prometheus + Grafana |
Containerization | Docker |
CI/CD | GitHub Actions (Docker build + deploy) |

-
ML Model (mlflow)
- Utilize dagshub to store experiments and model artifacts
- Registered and loaded using MLflow’s model registry
-
API (Flask)
- Receives prediction requests from the UI
- Forwards data to the ML model container
- Returns prediction + probabilities
- Logs metrics to Prometheus
-
UI (Streamlit)
- Allows users to input loan applicant data
- Connects to the Flask API
- Displays the prediction results
-
Monitoring
- Prometheus scrapes metrics from the API
- Grafana visualizes metrics like:
- API latency
- Request count
- CPU/RAM usage
- Model confidence distribution
Deployment is handled using GitHub Actions:
- Builds & pushes:
loan-streamlit
loan-api
loan-mlmodel
- Deploys & tests:
- Launches all containers via
docker-compose
- Waits for streamlit, api, prometheus, and grafana to pass health checks
- Prints logs for debugging if services fail
- Launches all containers via
Located in .github/workflows/deploy-compose.yml
- API exposes Prometheus metrics at /metrics
- Preconfigured prometheus.yml sets up scraping
- Grafana is provisioned with Prometheus as a data source
Ensure Docker, Prometheus, and Grafana are installed.
- Clone the Repository
git clone https://github.com/yourusername/loan-approval-predictor.git
cd loan-approval-predictor
- Set up virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install Dependency
pip install -r requirements.txt
- Set up environment variable using dotenv
Create .env
file, then fill in the necessary keys
MLFLOW_TRACKING_USERNAME=your_mlflow_username
MLFLOW_TRACKING_PASSWORD=your_mlflow_tracking_password
MLFLOW_TRACKING_URI=your_mlflow_tracking_uri
MLFLOW_EXPERIMENT_NAME=your_mlflow_experiment_name
MLFLOW_RUN_ID=your_model_run_id
DOCKER_HUB_USERNAME=your_docker_hub_username
- Run all services
docker compose up --build
- Access services
Service | URL |
---|---|
Streamlit UI | http://localhost:8501 |
Flask API | http://localhost:8000/health |
Prometheus | http://localhost:9090 |
Grafana | http://localhost:3000 |
- This project is not ready for live predictions; it's still in the test-deployment phase.
- While CI/CD pipelines for Docker images (model, API, UI, Prometheus, Grafana) are built and run with Docker Compose, I haven't done local tests due to a Docker Compose issue on my device. End-to-end testing to confirm all services run smoothly is highly needed.
- End-to-end testing
- Add testing (unit + integration)
- Enhance UI usability and model explainability
- Add service-level authentication (Flask, Grafana)
- Push to production deployment (GCP, ECS, Azure, etc.)
Built by Roissyah Fernanda, this is part of a broader effort to create full-stack machine learning pipelines with real deployment readiness. Feel free to send pull request, Let's collaborate!.