(generated_tensor_data, model_name)
return generate_code
Generate TensorFlow SDK in Python.

  Args:
    generated_tensor_data: Example is {"keys": [[1.0], [2.0]], "features": [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]}
Generate TensorFlow SDK in Python.
Generate TensorFlow SDK in Python .
def gen_tensorflow_client_string(generated_tensor_data, model_name):
  """
  Generate TensorFlow SDK in Python.

  Args:
    generated_tensor_data: Example is {"keys": [[1.0], [2.0]], "features": [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]}
  """

  code_template = """#!/usr/bin/env python

import requests

def main():
  endpoint = "http://127.0.0.1:8500"
  json_data = {"model_name": "{{ model_name }}", "data": {{ tensor_data }} }
  result = requests.post(endpoint, json=json_data)
  print(result.json())

if __name__ == "__main__":
  main()
  """

  generated_tensor_data_string = json.dumps(generated_tensor_data)
  template = Template(code_template)
  generate_code = template.render(
      model_name=model_name, tensor_data=generated_tensor_data_string)
  logging.debug("Generate the code in Python:\n{}".format(generate_code))

  return generate_code
def gen_tensorflow_client_string ( generated_tensor_data , model_name ) : code_template = """#!/usr/bin/env python

import requests

def main():
  endpoint = "http://127.0.0.1:8500"
  json_data = {"model_name": "{{ model_name }}", "data": {{ tensor_data }} }
  result = requests.post(endpoint, json=json_data)
  print(result.json())

if __name__ == "__main__":
  main()
  """ generated_tensor_data_string = json . dumps ( generated_tensor_data ) template = Template ( code_template ) generate_code = template . render ( model_name = model_name , tensor_data = generated_tensor_data_string ) logging . debug ( "Generate the code in Python:\n{}" . format ( generate_code ) ) return generate_code