LoanEase is a Flask-based web application designed to predict loan approval status using machine learning. The app uses a trained Gaussian Naive Bayes model to provide instant predictions based on user-provided input. It is deployed on Railway for ease of access.
- User-friendly loan approval form.
- Predicts loan approval status using machine learning.
- Validates user inputs (e.g., applicant income, loan amount, loan term).
- Displays personalized prediction results.
- Handles errors gracefully with descriptive error messages.
- Deployed on Railway for seamless access.
- Python: Core programming language.
- Flask: Web framework for building the app.
- Machine Learning: Gaussian Naive Bayes model for prediction.
- HTML/CSS: Frontend templates and styling.
- Railway: Cloud platform for app deployment.
.
├── Dockerfile # Docker instructions for building the app
├── app.py # Flask application entry point
├── core
│ ├── __init__.py # Core package initializer
│ ├── model_storage
│ │ └── gnb_model.pkl # Pre-trained Gaussian Naive Bayes model
│ ├── models.py # Model loading and prediction logic
│ ├── request.py # Input parsing and validation
│ ├── routes.py # Flask app routes
│ ├── static
│ │ ├── css
│ │ │ └── style.css # Styling for the app
│ │ └── images
│ │ ├── favicon.ico # App icon
│ │ └── loan.png # Logo for branding
│ └── templates
│ ├── error.html # Error page template
│ ├── index.html # Loan application form
│ └── prediction.html # Prediction result display
├── project_images # Documentation screenshots
│ ├── home.png # Screenshot of the Home Page
│ ├── prediction.png # Screenshot of the Prediction Page
│ ├── error.png # Screenshot of the Error Page
├── requirements.txt # Python dependencies
├── docker-compose.yml # Docker Compose configuration
├── README.md # Project documentation
git clone https://github.com/msjahid/loan-approval-analysis.git
cd loan-approval-analysis
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py
http://127.0.0.1:5000/
- Docker and Docker Compose installed on your machine.
- Your project structured properly (as defined earlier).
From the project directory, run the following command to build the Docker image:
docker-compose build
Start the application using:
docker-compose up
This will:
- Build the Docker container if it hasn’t been built already.
- Start the Flask application inside the container.
Once the container is running, open your browser and navigate to: Check your port number
http://127.0.0.1:4000
Visit https://railway.app/ and create an account.
- Click "New Project" → "Deploy from GitHub repo".
- Select your repository (e.g.,
loanease-app
).
- Railway auto-detects the Procfile and runtime.txt.
- Ensure dependencies in requirements.txt are accurate.
- Wait for the build and deployment to complete.
Railway provides a unique URL (e.g., https://loanease-app.up.railway.app/).
- Name: Cannot be empty or "0".
- Account Number: Cannot be "0".
- Applicant Income: Must be greater than 0.
- Loan Amount: Must be greater than 0.
- Loan Term: Must be at least 36 months.
- Credit History: Must be valid (0 or 1).
- Displays the loan prediction result.
- Shows personalized messages based on prediction status.
- Displays descriptive error messages for invalid inputs.
- Includes a visual illustration for better UX.
Name: Hasan Account Number: 123456 Applicant Income: 5000 Loan Amount: 150 Loan Term: 360 Credit History: 1 Property Area: Urban
Congratulations, Hasan! Your loan has been approved.
Account Number: 123456
Unfortunately, Hasan your loan has not been approved.
Account Number: 123456
-
Fork the repository.
-
Create a new branch for your feature:
git checkout -b feature-name
-
Commit your changes:
git commit -m "Add new feature"
-
Push to your branch:
git push origin feature-name
-
Submit a pull request for review.
This project is open-source and available under the MIT License.
- Author: Jahid Hasan
- GitHub: https://github.com/msjahid
- Email: msjahid.ai@gmail.com