How dheerajrai-dev/credilens works
CrediLens is an explainable credit-risk decision-support application. Applicants enter loan and personal attributes in the Streamlit dashboard; the client uses the FastAPI service when available, otherwise it invokes inference in-process. The service scores applicants, applies the calibrated-model threshold, and returns recommendations and explanations; separate dashboard views provide batch scoring, model evaluation, and global explainability. The README documents model artifacts and capabilities beyond the sampled service implementation, so those documented stages are included without asserting unsampled internal calls.
Main entry points: api_client.py API client · prediction_service.py Inference engine · streamlit_app.py Streamlit dashboard · prediction.py Prediction routes
Components 18
Dashboard
- Streamlit dashboard
app/frontend/streamlit_app.py - Applicant prediction
app/frontend/views/prediction_view.py - Model evaluation
app/frontend/views/evaluation_view.py - Global explainability
app/frontend/views/explainability_view.py - Batch scoring
app/frontend/views/batch_view.py - API client
app/frontend/api_client.py - Dashboard styling
app/frontend/styles.py
API Serving
- FastAPI service
app/api/main.py - Prediction routes
app/api/routes/prediction.py - Service dependency
app/api/dependencies.py - Model startup
app/api/lifespan.py
Risk Inference
- Inference engine
app/services/prediction_service.py - Calibrated model
models/Credit_risk_model.pkl - Baseline models
models/baselines.joblib - Decision threshold
models/best_threshold.pkl
Data Contracts
- Applicant schema
app/schemas/credit.py - Runtime configuration
app/core/config.py
Other components
- Credit analyst
Connections 24
- Credit analyst → Streamlit dashboard: uses
README.md - Streamlit dashboard → Applicant prediction: dispatches
app/frontend/streamlit_app.py - Streamlit dashboard → Model evaluation: dispatches
app/frontend/streamlit_app.py - Streamlit dashboard → Global explainability: dispatches
app/frontend/streamlit_app.py - Streamlit dashboard → Batch scoring: dispatches
app/frontend/streamlit_app.py - Streamlit dashboard → API client: creates
app/frontend/streamlit_app.py - Streamlit dashboard → Dashboard styling: applies
app/frontend/streamlit_app.py - Applicant prediction → API client: requests predictions
app/frontend/views/prediction_view.py - Model evaluation → API client: requests evaluation
app/frontend/views/evaluation_view.py - Batch scoring → API client: requests scoring
- API client → FastAPI service: calls over HTTP
app/frontend/api_client.py - API client → Inference engine: falls back in-process
app/frontend/api_client.py - API client → Applicant schema: validates input
app/frontend/api_client.py - API client → Runtime configuration: reads host and port
app/frontend/api_client.py - FastAPI service → Prediction routes: registers routes
- Prediction routes → Service dependency: resolves service
app/api/routes/prediction.py - Service dependency → Inference engine: gets instance
app/api/dependencies.py - Prediction routes → Inference engine: calls inference
app/api/routes/prediction.py - Prediction routes → Applicant schema: validates and returns
app/api/routes/prediction.py - Model startup → Inference engine: initializes
app/api/lifespan.py - Inference engine → Calibrated model: loads and scores
README.md - Inference engine → Baseline models: loads for comparison
README.md - Inference engine → Decision threshold: loads decision cutoff
README.md - Inference engine → Applicant schema: returns typed results
app/api/routes/prediction.py