<reponame>xiabai84/tensorflow_for_engineer<filename>11_tf_serving/client_tf_request.py
import requests
import json

image = r"./test2.jpg"
URL = "http://localhost:8501/v1/models/my_model:predict"
headers = {"content-type": "application/json"}
data = [1.8]
print(data)
body = {
    "signature_name": "prediction",
    "instances": [{"input": data}]
    }
r = requests.post(URL, data=json.dumps(body), headers = headers)
print(r.text)


import requests
import json

image = r"./test2.jpg"
URL = "http://localhost:8501/v1/models/my_model:predict"
headers = {"content-type": "application/json"}
data = [1.8]
print(data)
body = {
    "signature_name": "prediction",
    "instances": [{"input": data}]
    }
r = requests.post(URL, data=json.dumps(body), headers = headers)
print(r.text)