The Wehkamp ML platform

Harm Weites
Jan 9 · 6 min read

Wehkamp ML platform, general overview
name: blaze-visual-similarity-model
blaze:
service:
id: visual-similarity
team: rnd
description: "Returns a list of (visually) similar products"
main-language: python
routing:
consumer:
exposed: False
ml:
model:
version: 4f1255f50f5f32e93b4fb69704d23f466e468ebd
pickle: true
input_type: doubles
slo: 100000
default_output: "0.00"
pkgs:
- scikit-learn
- pandas
from clipper_admin.deployers.deployer_utils import save_python_function
import pandas as pd
import glob
import os
path_sim_pro = "list_of_similar_products.json"def read_json_folder(path_folder):
json_files = glob.glob(os.path.join(path_folder, "*.json"))
df_subs = [pd.read_json(os.path.join(path_folder, f), lines=True) for f in json_files]
df_sim = pd.concat(df_subs, ignore_index=True)
df_sim.set_index('productNumber', inplace=True)
dict_sim = df_sim.to_dict('index')
return dict_sim
def get_similar_list(prod_numbers):
return [str(dict_pro[int(p)]['similarProducts']) for p in prod_numbers]
dict_pro = read_json_folder(path_sim_pro)save_python_function(None, get_similar_list)
Deploying blaze-clipper-model:56-1621f4d
Application blaze-clipper-model is not registered with Clipper
Deploying new model, creating application blaze-clipper-model
Application blaze-clipper-model was successfully registered
Model blaze-clipper-model:56-1621f4d is not registered with Clipper.
Checking local EKS proxy...
Deploying 2 instances of blaze-clipper-model:56-1621f4d to EKS
Successfully registered model blaze-clipper-model:56-1621f4d
Done deploying model blaze-clipper-model:56-1621f4d.
Linking model blaze-clipper-model:56-1621f4d to app...
Model blaze-clipper-model is now linked to application blaze-clipper-model
MODEL                          VERSION      STATE INSTANCES INPUT
blaze-visual-similarity-model 34-b325e65 CA 2 integers
import json
import requests
x = requests.post(
"http://ml-gateway.blaze/blaze-clipper-model/predict",
data=json.dumps({"input": [1.1, 5.1]})
).json()
print(x)
{u'default': False, u'output': 6.199999999999999, u'query_id': 42}

wehkamp-techblog

We'll try to keep up and post on the stuff we're doing and discovering. Interesting in working @wehkamp? Check out https://werkenbij.wehkamp.nl/

Harm Weites

Written by

wehkamp-techblog

We'll try to keep up and post on the stuff we're doing and discovering. Interesting in working @wehkamp? Check out https://werkenbij.wehkamp.nl/