| title | Loan Scoring Model |
|---|---|
| emoji | 💰 |
| colorFrom | red |
| colorTo | yellow |
| sdk | docker |
| sdk_version | 29.1.4 |
| app_file | src/api/main.py |
| pinned | false |
This project presents an API that uses a machine learning model to score loan applications, and a Web Application that allows users to interact with the API and monitor the model's performance and drift.
You will need to get few services in order to use this project. They are free but needs some configuration.
Create an account on BetterStack:
- Create a project and a source
- Retrieve the token and the host
- Store them in
.envasLOGTAIL_TOKENandLOGTAIL_HOST(with "https//") and in Github Secrets - Now create an API Token for this source
- And store the username, the password and the host as
BETTERSTACK_USERNAME,BETTERSTACK_PASSWORDandBETTERSTACK_HOSTin.env
The database should look like this:

This project uses Docker to build and run the API and Web Application. To install Docker, follow the instructions on the Docker website.
Then at the root of the project, run:
docker compose up -d
Then .env should contain the following variables:
LOGTAIL_TOKEN,LOGTAIL_HOST,BETTERSTACK_USERNAME,BETTERSTACK_PASSWORD,BETTERSTACK_HOST,API_BASE_URL=http://api:8000
You can then access the API at http://localhost:8000, and the Web Application at http://localhost:8050.
The Web Application allows you two things:
- In the
Demotab, you can query the API to retrieve the information of a specific client (based on itsSK_ID_CURR) and see what score the model predicts for this client,
- In the
Analyticstab, you can see :- An Evidently Drift Report,
- The API usage over the past day,
- The score distribution predicted by the API over the past day,
- The live API latency (refreshed every 5 seconds).
The API is a FastAPI application that uses a machine learning model to score loan applications. The API is deployed on Docker and the doc can be accessed at http://api:8000/doc.

