Skip to content

berry2012/Containerizing-Stackloss-Model

Repository files navigation

StackLoss DataSet Using Linear Regression

Build a linear model for the stackloss dataset to predict the value of StackLoss from the other (independent) variables.

Topics

  • Building and Training Model
  • Deploying ML Model to Docker Containers

Notebook: click link

Notebook Prediction


Container Deployment Section

Notebook Prediction

Build the image

docker build -t berry2012/q7stackloss-quadratic-model:v1 .

Run container locally

docker network create --subnet 192.168.1.0/24 --driver bridge web_net_1
docker run -d --name api -p 8000:8000 --network=web_net_1 --ip 192.168.1.11 berry2012/q7stackloss-quadratic-model:v1 

export API_URL="http://192.168.1.11:8000"

test the app from the browser

http://0.0.0.0:8000
http://0.0.0.0:8000/docs
http://localhost:8000/predict?x=80,27,89,42,95

Sample prediction

# format with named data
curl -X POST \
  http://localhost:8000/predict \
  -H "Content-Type: application/json" \
  -d '{"X": [80, 27, 89, 42, 95]}'

Accessing the Model API Service at Scale

stackloss with StreamLit

  • Using Another Client Application to consume the API
python consumer.py
  • Through a UI App

Build the image

docker build -t berry2012/ui-q7stackloss-quadratic-model:v1 .

Run container locally

docker run -d --name ui -p 8501:8501 --network=web_net_1 --ip 192.168.1.12 berry2012/ui-q7stackloss-quadratic-model:v1 

test the app from the browser

http://0.0.0.0:8501

About

Build a linear model for the stackloss dataset to predict the value of StackLoss from the other (independent) variables.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors