From 89070304c749138910c755e6db8f82bf71b1e652 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Wed, 1 Apr 2020 08:36:08 +0000 Subject: [PATCH] fix image http demo --- python/examples/imagenet/image_http_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/examples/imagenet/image_http_client.py b/python/examples/imagenet/image_http_client.py index 2a2e9ea2..cda0f33a 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 -- GitLab