This file contains 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 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 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 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 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 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 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 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 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_server | |
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 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 tracer | |
import ( | |
"io" | |
"github.com/uber/jaeger-client-go/config" | |
jprom "github.com/uber/jaeger-lib/metrics/prometheus" | |
) | |
func NewTracer() (opentracing.Tracer, io.Closer, error) { |