diff --git a/python/examples/imagenet/image_classification_service_gpu.py b/python/examples/imagenet/image_classification_service_gpu.py index 51f79179e02d78cf56a235c01f768d11a19f60b4..8fc92d918867142c6c442cb9eba61e2a9fb1f0e5 100644 --- a/python/examples/imagenet/image_classification_service_gpu.py +++ b/python/examples/imagenet/image_classification_service_gpu.py @@ -18,7 +18,12 @@ import os import base64 from image_reader import ImageReader + class ImageService(WebService): + """ + preprocessing function for image classification + """ + def preprocess(self, feed={}, fetch=[]): reader = ImageReader() if "image" not in feed: diff --git a/python/examples/imagenet/image_http_client.py b/python/examples/imagenet/image_http_client.py index bcb391f82a57742be526c8c4dd1de1e1729d0a4d..74cafaa850aa02122127ce2457af07f853e1ac94 100644 --- a/python/examples/imagenet/image_http_client.py +++ b/python/examples/imagenet/image_http_client.py @@ -17,12 +17,12 @@ import base64 import json import time + def predict(image_path, server): image = base64.b64encode(open(image_path).read()) req = json.dumps({"image": image, "fetch": ["score"]}) r = requests.post( server, data=req, headers={"Content-Type": "application/json"}) - #print(r.json()["score"]) if __name__ == "__main__":