Skip to content

Ajitkumar-1001/Loan_prediction_App

Repository files navigation

💰 Loan Prediction System

🔍 A Smart Loan Approval AI Tool Predict Loan Approval using Machine Learning , with REST API

Build Passing License: MIT Python Version Repo Size


📌 Overview

This project predicts Loan Approval with trained machine learning models such as (Logistic Regression , Ridge Classification, XGBOOST and Random forest Classifier )built on credit and income features. Additionally, it generates custom financial advice using a LLM, customized Report based on the outcome.

🔧 Stack:
FastAPI (backend) + SQLite3 (database) + React + Tailwind + TypeScript (frontend) + MLflow (tracking) + **LLM ** for insights.


🚀 Features

  • 📊 Trained ML model using feature engineering, PCA, and classification algorithms
  • 🧠 MLflow experiment tracking
  • 🔗 SQLite3 for relational data
  • 🧪 FastAPI backend for inference
  • 💻 React + TypeScript frontend with animated results
  • 💬 LLM response according to the Result
  • 🌐 Ready for cloud deployment

📦 Step 1: Environment Setup

Python Version: 3.8 - 3.10 (Recommended < 3.11)

git clone https://github.com/Ajitkumar-1001/Loan_prediction_App.git
cd Loan_prediction_App
python -m venv Loan_App
source Loan_App/bin/activate
pip install -r requirements.txt

2️⃣ Database Setup

Create a SQLite database and required tables from the CSV dataset.

python create_database.py

3️⃣ Model Training + Logging

Train the model with feature selection, PCA, and classifiers like Logistic Regression, Random Forest, and Ridge. Log metrics using MLflow.

python train_model.py

Logged to dagshub


🧠 FastAPI Backend

🔧 Start the server:

uvicorn loan_api.main:app --reload

🔁 Endpoints:

  • POST /Loan/predict-loan → returns prediction + LLM-based suggestion

💻 React Frontend

📁 Navigate to frontend:

cd frontend
npm install

🚀 Start development server:

npm run dev
  • Form input fields
  • Animated prediction + suggestions
  • Validation to avoid empty or negative values

📬 API Example

POST /Loan/predict-loan
{
  "IncomePerDependent": 10000,
  "LoanAmount": 2500000,
  "RiskScore": 650,
  "TotalDebtToIncomeRatio": 0.4,
  "InterestRate": 7.5,
  "AnnualIncome": 60000,
  "BaseInterestRate": 5.5
}

Response:

{
  "prediction": "Approved",
  "message": "You are eligible for the loan.",
  "llm_response": "Based on your high income and low risk, we suggest going ahead with the loan application."
}

📚 Tech Stack

  • FastAPI
  • SQLite3
  • MLflow
  • React + TailwindCSS
  • LLM (Flash-2.0)
  • Docker-ready

🧑‍💻 Author

Ajit Kumar — GitHub


📜 License

This project is licensed under the MIT License.

About

A smart Bank Loan Approval Status detection system, designed to help customer know their Financial credibility and Risk's of Credit FICO score !,

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors