
Part-1 + Part-2
we will not build the machine learning model from the very start. I will just serialize the model and grab the pickle file of the model and we will good to go. You can download the whole code from my github repo ( with very explained readme.md file).
It is a good practice to create environment for your new project. this is how you can create new env with anaconda…
step 1: conda create -n "<env_name>" python=3.x
step 2: conda activate "<env_name>"
step 3: pip install required packages
Now i m assuming that, you have pickle file classifier.pkl
of our model. let’s creat a Flask api quickly.
from picklefrom flask import Flask, request
app = Flask(__name__) # Important
pickle_in = open("classifier.pkl", "rb")
classifier = pickle.load(pickle_in)
@app.route('/')
def Welcome():
return "Hello World"
@app.route('/predict')
def predict_note_authentication():
variance=request.args.get('variance')
skewness=request.args.get('skewness')
curtosis=request.args.get('curtosis')
entropy=request.args.get('entropy')
prediction =classifier.predict([[variance,skewness,curtosis,entropy]])
return "Predicted value is"+str(prediction)
if __name__=='__main__':
app.run()
You do not need to install flask individually, latest version of anaconda comes with flask.type in cmdpython flask_app.py
to run and go to http address to check if it working will print Hello World.
Cool!
Now we have our flask api for our model.Now it is time to dockerize but before it lets understand …
What is Docker and why use Docker?
Docker is one of the most popular tool used to containerize and deploy applicaitions over the internet.
let’s understand docker with a example : let assume you have bought a new home and you want to shift your furniture and stuff from old home to new home. How can u do that ? There are two ways
So what we are trying to do is, irrespective to operating system and hardware configration, we are trying to create a container.the requirements like os and hardware required on other side will be putted in the docker image and take the whole container to other side and run from other side environment.
In other words, It is fixing the environment standardization
#Build once and deploy everywhere.
Containers allows developers to package up an application with all the parts it needs.
Diffrence between Docker Containers and Virtual Machines
1. Docker Containers
2. Virtual Machines

Docker Image is a file, comprised of multipul layers which is used to execute code in a Doker Container.
Docker Container is a runtime instance of an image.It allows developers to package application with all parts needed such as librariesand other dependencies.
Docker File is a text document that contains necessary commands which on execution helps assemble a Docker Image.
Docker Engine hosts the containers. Docker engine is a client-server based application.
Docker Hub is the official online repo where you can find other docker images that are available to use. it makes it easy to find, manage and share container images with others.
Installation of Docker
Install Docker in Ubuntu ( skip if u have already installed )
Install Docker in Windows ( skip if u have already installed )
Love if it helps you and yes wait for Second part :)
Thank You