diff --git a/python/examples/imagenet/image_http_client.py b/python/examples/imagenet/image_http_client.py index 2a2e9ea20d7e428cfe42393e2fee60035c33283d..cda0f33ac82d0bd228a22a8f438cbe1aa013eadf 100644 --- a/python/examples/imagenet/image_http_client.py +++ b/python/examples/imagenet/image_http_client.py @@ -30,7 +30,10 @@ def predict(image_path, server): req = json.dumps({"image": image, "fetch": ["score"]}) r = requests.post( server, data=req, headers={"Content-Type": "application/json"}) - print(r.json()["score"][0]) + try: + print(r.json()["score"][0]) + except ValueError: + print(r.text) return r