Team Ai
Apppublic

Dadix/PD_estimation_XGBoost

sourceHugging Facemitupdated 4mo agoView on Hugging Face
1likes
App README

Credit Risk — Probability of Default

An interactive web app that predicts the probability of default for a borrower using an XGBoost classifier trained on the German Credit Dataset.

Features

  • —Inputs: Age, Sex, Job, Housing, Saving Accounts, Checking Account, Credit Amount, Duration, Purpose
  • —Output: Probability of default (%), creditworthiness score, risk tier (Low / Medium / High)
  • —Clean dark finance-themed UI

Files required in this Space

Upload these files alongside app.py:

FileDescription
XGBclassifier.pklTrained XGBoost model
Sex_encoder.pklLabelEncoder for Sex
Job_encoder.pklLabelEncoder for Job
Housing_encoder.pklLabelEncoder for Housing
Saving accounts_encoder.pklLabelEncoder for Saving accounts
Checking account_encoder.pklLabelEncoder for Checking account
Purpose_encoder.pklLabelEncoder for Purpose

How to export your model from the notebook

Add this cell at the end of your Colab notebook and run it:

python
import joblib

# Save the XGBoost model
joblib.dump(best_xgb, "XGBclassifier.pkl")

# Save all encoders (they were already saved during feature engineering,
# but re-save here to be sure)
for col in ['Sex', 'Job', 'Housing', 'Saving accounts', 'Checking account', 'Purpose']:
    joblib.dump(encoders[col], f"{col}_encoder.pkl")

# Download from Colab
from google.colab import files
files.download("XGBclassifier.pkl")
for col in ['Sex', 'Job', 'Housing', 'Saving accounts', 'Checking account', 'Purpose']:
    files.download(f"{col}_encoder.pkl")

Deployment on Hugging Face Spaces

  1. 1.Go to huggingface.co/new-space
  2. 2.Choose Gradio as the SDK
  3. 3.Upload all .pkl files + app.py + requirements.txt
  4. 4.The Space will build and launch automatically