This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package grpc_client | |
| import ( | |
| "github.com/opentracing/opentracing-go" | |
| "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing" | |
| "github.com/grpc-ecosystem/go-grpc-middleware" | |
| "google.golang.org/grpc" | |
| "github.com/masroorhasan/myapp/tracer" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| TAG=$1 | |
| docker run -v $(pwd):/gb_housing seldonio/core-python-wrapper:0.7 \ | |
| /gb_housing \ | |
| HousingGBServe \ | |
| $TAG \ | |
| masroorhasan \ | |
| --service-type=MODEL \ | |
| --grpc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| APP=$1 | |
| ENV=$2 | |
| NS=$3 | |
| # Ref: https://github.com/SeldonIO/seldon-core/blob/master/docs/install.md | |
| # create a ksonnet app | |
| ks init ${APP} --api-spec=version:v1.8.6 | |
| # install seldon-core |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: machinelearning.seldon.io/v1alpha2 | |
| kind: SeldonDeployment | |
| metadata: | |
| labels: | |
| app: seldon | |
| ksonnet.io/component: housing-serve-gb | |
| name: housing-serve-gb | |
| namespace: seldon-serving | |
| spec: | |
| annotations: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "flag" | |
| "log" | |
| "google.golang.org/grpc" | |
| "google.golang.org/grpc/metadata" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import joblib | |
| import numpy as np | |
| class HousingGBServe(object): | |
| def __init__(self, model_file='gb_regressor.dat'): | |
| self.model = joblib.load(model_file) | |
| def predict(self, X, feature_names): | |
| prediction = self.model.predict(X) | |
| return [[prediction.item(0), prediction.item(0)]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: machinelearning.seldon.io/v1alpha2 | |
| kind: SeldonDeployment | |
| metadata: | |
| labels: | |
| app: seldon | |
| ksonnet.io/component: ab-testing-housing-serve | |
| name: ab-testing-housing-serve | |
| namespace: seldon-serving | |
| spec: | |
| annotations: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -X POST seldon-core-ambassador.ml-serving:80/seldon/ab-testing-housing-serve/api/v0.1/predictions -d '{"data":{"tensor":{"shape":[1,37],"values":[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0]}}}' -H "Content-Type: application/json" | |
| { | |
| "meta": { | |
| "puid": "l7h22gr2malu8hv5om8u4p4kcp", | |
| "tags": { | |
| }, | |
| "routing": { | |
| "ab-test": 1 | |
| }, | |
| "requestPath": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -X POST localhost:5000/predict -d 'json={"data":{"tensor":{"shape":[1,37],"values":[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0]}}}' | |
| { | |
| "data": { | |
| "names": [ | |
| "t:0", | |
| "t:1" | |
| ], | |
| "tensor": { | |
| "shape": [ | |
| 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| TAG=$1 | |
| SELDON_WRAPPER_IMAGE_TAG=0.5-SNAPSHOT | |
| s2i build \ | |
| -E ${ENV} . \ | |
| seldonio/seldon-core-s2i-python2:${SELDON_WRAPPER_IMAGE_TAG} \ | |
| masroor/housing-gb-serving:${TAG} |