November 2017
Intermediate to advanced
304 pages
6h 58m
English
In the project repository, we have already provided a package named production. In that package, we need to copy the labels.txt file into our dataset, create a new Python file, client.py, and add the following code:
import tensorflow as tf import numpy as np from tensorflow_serving.apis import prediction_service_pb2, predict_pb2 from grpc.beta import implementations from scipy.misc import imread from datetime import datetime class Output: def __init__(self, score, label): self.score = score self.label = label def __repr__(self): return "Label: %s Score: %.2f" % (self.label, self.score) def softmax(x): return np.exp(x) / np.sum(np.exp(x), axis=0) def process_image(path, label_data, top_k=3): start_time = datetime.now() ...
Read now
Unlock full access