Skip to content

shayannab/CreditAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 

Repository files navigation

Credit Prediction API

A simple RESTful API that predicts a user's creditworthiness (credit scoreโ€“like value) based on their financial data using Machine Learning.

Built with โค๏ธ using FastAPI + Scikit-Learn, this project is designed to help developers or fintech apps integrate credit prediction functionality into their systems.

๐Ÿš€** Features**

๐Ÿ”ฎ Predict creditworthiness from financial data

โšก Fast and lightweight (built on FastAPI)

๐Ÿง  Machine learning model trained on sample credit data

๐Ÿงฉ Ready for integration into web or mobile apps

๐Ÿ›ก๏ธ Clean structure and modular code ** ๐Ÿงฐ Tech Stack**

Backend: FastAPI (Python)

ML Model: Scikit-Learn

**Data Processing: **Pandas, NumPy

Server: Uvicorn (for local hosting)

๐Ÿ“‚ Folder Structure project-bolt/ โ”‚ โ”œโ”€โ”€ app/ โ”‚ โ”œโ”€โ”€ main.py # Main API entry point
โ”‚ โ”œโ”€โ”€ model.py # ML model loading and prediction logic
โ”‚ โ”œโ”€โ”€ schemas.py # Request and response validation
โ”‚ โ”œโ”€โ”€ utils.py # Helper functions
โ”‚ โ”œโ”€โ”€ init.py
โ”‚ โ”œโ”€โ”€ model/ โ”‚ โ””โ”€โ”€ credit_model.pkl # Trained machine learning model
โ”‚ โ”œโ”€โ”€ data/ โ”‚ โ””โ”€โ”€ sample_data.csv # Example dataset
โ”‚ โ”œโ”€โ”€ requirements.txt # Dependencies
โ””โ”€โ”€ README.md # You are here ๐Ÿ‘‹

โš™๏ธ Installation & Setup 1๏ธโƒฃ Clone the repo git clone https://github.com/yourusername/credit-prediction-api.git cd credit-prediction-api

2๏ธโƒฃ** Create a virtual environment** python -m venv venv source venv/bin/activate # (Windows: venv\Scripts\activate)

3๏ธโƒฃ** Install dependencies** pip install -r requirements.txt

4๏ธโƒฃ** Run the API** uvicorn app.main:app --reload

Your API will be live at ๐Ÿ‘‰ http://127.0.0.1:8000

๐Ÿ”—** Endpoints** POST /predict

Description: Predict a userโ€™s credit score range

Request Body (JSON):

{ "age": 29, "income": 45000, "loan_amount": 12000, "employment_status": "Full-Time", "credit_history": 4 }

Response (JSON):

{ "credit_score": 720, "risk_level": "Low" }

๐Ÿง  How It Works (Simplified)

User sends their financial info via POST request.

API validates data using Pydantic schemas.

The trained ML model predicts the userโ€™s creditworthiness.

Response returns credit score + risk level.

๐ŸŒ** Deployment**

You can host this API easily on:

Render

Railway

Vercel (Serverless FastAPI)

AWS / GCP / Azure

๐Ÿ’ก** Real-World Use Cases**

๐Ÿฆ Fintech apps checking user eligibility

๐Ÿ’ณ Loan approval systems

๐Ÿ“ฑ Credit simulation for learning/finance apps

๐Ÿงพ Data dashboards for financial risk analysis

๐Ÿงฉ Future Improvements

Connect to real user data (CIBIL-style APIs)

Add user authentication

Store prediction history in DB

Create frontend dashboard

๐Ÿซถ** Credits**

Built by shayanna โ€” with the vision to make credit analysis more transparent, accessible, and AI-driven ๐Ÿš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published