Skip to content

Latest commit

ย 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Credit Risk Classifier API

A production-ready FastAPI application that predicts whether a loan applicant is a Good or Bad credit risk based on structured financial and demographic data. This project demonstrates how to deploy a trained ML model behind a RESTful API interface.


๐Ÿง  Project Overview

The API takes in customer input via JSON and returns a prediction based on a Decision Tree Classifier trained on credit data. The model is serialized using pickle (tree_Accuracy_based.pkl) and loaded into the app during runtime.

Built with FastAPI โ€” a blazing-fast, modern Python web framework โ€” this API is ideal for deploying ML models in real-world applications.


โœ… Features

  • โœ… Input validation using Pydantic models (bank.py)
  • โœ… Model loaded dynamically via Pythonโ€™s pickle
  • โœ… Clean JSON endpoints for easy integration
  • โœ… Automatic Swagger Docs at /docs
  • โœ… Human-readable prediction response

๐Ÿ” How It Works

  1. The user sends a POST request with financial data in JSON format.
  2. FastAPI + Pydantic validates and parses the input.
  3. The decision tree model makes a prediction (1 = Good, 0 = Bad).
  4. The API returns a friendly response like:
    {"Prediction": "Good"}

About

Hi! This is my first hands on project for deploying a Machine Learning model using FastAPI. It Shows to serve predictions via a RESTful API using a trained Classifier. This project helped me understand the end-to-end workflow of taking a model from training to deployment using modern Python tools like FastAPI, Pydantic, and Uvicorn.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages