Machine Learning · Full Stack Project Case Study

Loan Portfolio Lab: From Streamlit to a Full Stack Model Explorer

Illustrative preview of Loan Portfolio Lab's scenario form and model output

Loan Portfolio Lab is an educational interface for exploring a saved historical loan repayment model. I rebuilt the original Streamlit prototype as a responsive frontend and a separate FastAPI service, both deployed on Render.

ArchitectureStatic frontend + FastAPI model API
ModelSaved scikit-learn random forest
Current statusFictional scenarios; no lending decisions

What the original prototype did

The first version offered a Streamlit form for eight inputs and displayed a binary prediction. The saved model, however, expects 19 feature columns. The missing columns were automatically filled with zeros. That made the interface look complete while silently imposing assumptions about credit history, revolving balance, delinquencies, public records and loan purpose.

Screenshot of the earlier Streamlit loan prediction prototype
The earlier Streamlit prototype. The new application uses a separate API and exposes the fields that the saved model expects.

The redesign

The new Loan Portfolio Lab has three parts: a guided scenario form, a result panel, and plain language notes on what the output can and cannot establish. It starts with fictional values and asks visitors to avoid real applicant data. The form requests the numerical inputs and one loan purpose, which the API maps to seven purpose indicators.

Reading the result correctly

The target in the source notebook is named not.fully.paid. The new interface calls its output a historical not fully paid model score. It does not call a score a verified probability that a loan will default, and it does not return an approval or denial. A score of 10% for the fictional example simply reflects how that saved random forest responded to those inputs.

What is needed before institutional use

A real evaluation needs the training dataset and documented data rights, a reproducible test split appropriate to time, calibration analysis, subgroup and fairness assessment, feature provenance, monitoring for changing data, access controls, and independent review of applicable credit rules. Specific reasons for any real credit decision must be supported by the institution's actual decision process; this demo does not generate those reasons. The current app is a portfolio demonstration for model exploration.

Technology and next steps

The deployed version uses Python, Pandas, scikit-learn 1.5.1, FastAPI, HTML, CSS, JavaScript and two Render services. The code pins the model's original scikit-learn version and Python runtime for compatibility. Next, I would recover the source data, reproduce the training pipeline and evaluation, document model cards and data lineage, test accessibility, and only then consider a governed pilot with qualified reviewers.

Ebenezer Kwaw
Public health, data, artificial intelligence and digital innovation professional based in Ghana.

← Back to all insights