CoolFace
Apppublic

aaka8566/creditScoring

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
App README

๐Ÿฆ NBFC AI Credit Scoring System

![Live Demo](https://huggingface.co/spaces/YOURUSERNAME/YOURSPACE_NAME)

An advanced AI-powered credit scoring API designed for Non-Banking Financial Companies (NBFCs) with bank statement verification capabilities.

๐Ÿš€ Features

  • โ€”Hybrid AI Scoring: XGBoost + Rule-based scoring for accurate risk assessment
  • โ€”Bank Statement Processing: OCR-based extraction and verification (PDF/Image support)
  • โ€”Fraud Detection: Real-time red flag analysis
  • โ€”Alternative Data Integration: Beyond traditional credit scores
  • โ€”Batch Processing: Score multiple applications simultaneously
  • โ€”REST API: FastAPI-powered endpoints with automatic documentation

๐Ÿ“Š API Endpoints

1. Basic Credit Scoring

bash
POST /score

Score a loan application using traditional credit data.

2. Bank Statement Verification

bash
POST /score/with-statement

Enhanced scoring with bank statement upload and verification.

3. Batch Processing

bash
POST /score/batch

Process multiple loan applications at once.

4. Health Check

bash
GET /health

๐Ÿ”— Interactive Documentation

Once deployed, visit:

  • โ€”Swagger UI: https://YOUR_SPACE_URL/docs
  • โ€”ReDoc: https://YOUR_SPACE_URL/redoc

๐Ÿ“ Example Usage

Simple Scoring Request

bash
curl -X POST "https://YOUR_SPACE_URL/score" \
  -H "Content-Type: application/json" \
  -d '{
    "age": 30,
    "income": 50000,
    "loan_amount": 500000,
    "employment_type": "Salaried",
    "credit_score": 720,
    "existing_debt": 100000
  }'

Bank Statement Scoring

bash
curl -X POST "https://YOUR_SPACE_URL/score/with-statement" \
  -F "bank_statement=@statement.pdf" \
  -F "age=30" \
  -F "income=50000" \
  -F "loan_amount=500000" \
  -F "employment_type=Salaried" \
  -F "credit_score=720" \
  -F "existing_debt=100000"

๐Ÿ› ๏ธ Technology Stack

  • โ€”Framework: FastAPI
  • โ€”ML Models: XGBoost, Scikit-learn
  • โ€”OCR: EasyOCR
  • โ€”Document Processing: PyPDF2, OpenCV
  • โ€”Deployment: Docker on Hugging Face Spaces

๐Ÿ“ˆ Response Format

json
{
  "enhanced_score": 45.5,
  "risk": "Medium Risk",
  "decision": "Review",
  "reasons": [
    "High DTI ratio (60%)",
    "Good credit score"
  ],
  "recommendations": [
    "Request additional income verification",
    "Consider shorter tenure"
  ],
  "statement_verification": {
    "verified": true,
    "verified_income": 48500,
    "income_match": true,
    "red_flags": []
  }
}

โš™๏ธ Model Information

The system uses a hybrid approach:

  1. 1.XGBoost Model: ML-based risk prediction
  2. 2.Rule-based System: Business logic and compliance checks
  3. 3.Alternative Data: Banking behavior, transaction patterns
  4. 4.Fraud Detection: Red flag analysis from bank statements

๐Ÿ”’ Privacy & Security

  • โ€”No data is stored permanently
  • โ€”All processing happens in-memory
  • โ€”GDPR and data privacy compliant
  • โ€”Secure file handling for bank statements

๐Ÿ“– Documentation

For detailed API documentation and examples, see:

  • โ€”API_USAGE_EXAMPLES.md
  • โ€”BANK_STATEMENT_GUIDE.md
  • โ€”Interactive API docs at /docs

๐Ÿค Use Cases

  • โ€”NBFC Loan Origination: Automated credit assessment
  • โ€”Microfinance: Quick decisions for small loans
  • โ€”Digital Lending Platforms: API integration
  • โ€”Financial Inclusion: Alternative data for thin-file customers

๐Ÿ“Š Performance

  • โ€”Average scoring time: < 2 seconds
  • โ€”Bank statement processing: < 10 seconds
  • โ€”Support for PDF and image formats
  • โ€”Batch processing available

๐Ÿ› Known Limitations

  • โ€”Ollama AI explanations not available on HF Spaces (cloud limitation)
  • โ€”Large PDF files (>10MB) may take longer to process
  • โ€”OCR accuracy depends on statement quality

๐Ÿ“„ License

This project is for demonstration and educational purposes.

๐Ÿ”— Links


Built with โค๏ธ using FastAPI and deployed on ๐Ÿค— Hugging Face Spaces