Skip to content

Deploy a credit card service using flask, docker and AWS EBS

Notifications You must be signed in to change notification settings

midejoe/Deploy-credit-card-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy-credit-card-model

Models

We've prepared a dictionary vectorizer and a model.

They were trained (roughly) using this code:

features = ['reports', 'share', 'expenditure', 'owner'] dicts = df[features].to_dict(orient='records')

dv = DictVectorizer(sparse=False) X = dv.fit_transform(dicts)

model = LogisticRegression(solver='liblinear').fit(X, y)

Preparation

Import the pickle package to save the model

Running without Docker

First, install flask:

pip install flask

Run the service:

python credit_card.py

Test it from python:

import requests
url = 'http://localhost:9696/predict'
response = requests.post(url, json=customer)
result = response.json()

Managing dependencies with Pipenv

Install pipenv:

pip install pipenv

Install the depencencies from the Pipfile:

pipenv install

Enter the pipenv virtual environment:

pipenv shell

And run the code:

python credit_card.py

Alternatively, you can do both steps with one command:

pipenv run python credit_card.py

Now you can use the same code for testing the model locally.

Running with Docker

Build the image (defined in Dockerfile)

docker build -t credit-card-prediction .

Run it:

docker run -it -p 9696:9696 credit-card-prediction:latest

About

Deploy a credit card service using flask, docker and AWS EBS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages