- Install dependencies:
pip install -r ./dev-requirements.txt
- Download dataset
The dataset could be found on https://www.openml.org/search?type=data&sort=runs&id=42175&status=active It is in arff format.
- Train the fraud detection xgboost model. For details, see the https://www.kaggle.com/code/marcelotc/creditcard-fraud-xgboost-example notebook:
./train.sh
- Run the ML Service locally:
bentoml serve
- Send test requests:
Visit http://localhost:3000/ in a browser and send test requests via the UI.
Alternatively, send test payloads via CLI:
curl -X POST -H "Content-Type: application/json" -d @test.json http://127.0.0.1:3000/predict
- Build a docker image for deployment
Build a Bento to lock the model version and dependency tree:
bentoml build
Ensure docker is installed and running, build a docker image with bentoml containerize
bentoml containerize credit_card_fraud_detection:latest
Test out the docker image built:
docker run -it --rm -p 3000:3000 credit_card_fraud_detection:{YOUR BENTO VERSION}