code: def _do_local_inference(host, port, serialized_examples):
      """Performs inference on a model hosted by the host:port server."""
  
      json_examples = []
      for serialized_example in serialized_examples:
          # The encoding follows the guidelines in:
          # https://www.tensorflow.org/tfx/serving/api_rest
          example_bytes = base64.b64encode(serialized_example).decode(
              "utf-8"
          )
          predict_request = '{ "b64": "%s" }' % example_bytes
          json_examples.append(predict_request)
  
      json_request = (
          '{ "instances": [' + ",".join(map(str, json_examples)) + "]}"
      )
  
      server_url = (
          "http://"
          + host
          + ":"
          + port
          + "/v1/models/chicago_taxi:predict"
      )
      response = requests.post(
          server_url,
          data=json_request,
          timeout=_LOCAL_INFERENCE_TIMEOUT_SECONDS,
      )
      response.raise_for_status()
      prediction = response.json()
      print(json.dumps(prediction, indent=4))
  
imports: import argparse
  import base64
  import csv
  import json
  import os
  import subprocess
  import tempfile
  from typing import List
  from absl import app
  from absl.flags import argparse_flags
  import requests
  import tensorflow_data_validation
  from tensorflow_transform import coders
  from tensorflow_transform.tf_metadata import schema_utils
  from google.protobuf import text_format
  from tensorflow.python.lib.io import file_io
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: _do_local_inference(host, port, serialized_examples) without return types