How jensbender/loan-default-prediction works
This is a loan-default risk prediction web application. A borrower enters application details in Gradio; the frontend formats them and posts to FastAPI, which validates inputs, runs the downloaded scikit-learn pipeline, applies its prediction threshold, and returns a prediction with probabilities. The pipeline includes missing-value handling, feature engineering, encoding/scaling, selection, and a Random Forest model. Backend monitoring and optional IP geolocation are also represented. Pipeline internals are sampled, but portions of the backend are omitted, so uncertain processing links are not expanded.
Main entry points: backend/app.py FastAPI endpoint · pipeline.py Random Forest pipeline · frontend/app.py Gradio form · schemas.py Input/output schemas
Components 10
User interface
- Gradio form
frontend/app.py
Prediction service
- FastAPI endpoint
backend/app.py - Input/output schemas
backend/schemas.py
Prediction pipeline
- Random Forest pipeline
src/pipeline.py - Feature engineering
src/custom_transformers.py - Feature mappings
src/global_constants.py
Monitoring
- Prediction logging
backend/app.py - GeoIP database
Other components
- Applicant
- Hugging Face Hub
Connections 12
- Applicant → Gradio form: enters application
README.md - Gradio form → FastAPI endpoint: posts prediction request
frontend/app.py - FastAPI endpoint → Input/output schemas: validates inputs
backend/app.py - FastAPI endpoint → Random Forest pipeline: runs inference
README.md - Random Forest pipeline → Feature engineering: uses transformers
src/pipeline.py - Random Forest pipeline → Feature mappings: configures stages
src/pipeline.py - Input/output schemas → Feature mappings: uses allowed labels
backend/schemas.py - FastAPI endpoint → Prediction logging: writes prediction records
backend/app.py - FastAPI endpoint → GeoIP database: looks up client country
backend/app.py - FastAPI endpoint → Hugging Face Hub: downloads pipeline
backend/app.py - Hugging Face Hub → Random Forest pipeline: supplies serialized pipeline
README.md - FastAPI endpoint → Gradio form: mounts Gradio app
backend/app.py