class_docstr: WIT widget base class for common code between Jupyter and Colab.
docstr: Performs inference on examples that require inference.
docstr_tok: ["Performs","inference","on","examples","that","require","inference","."]
code: def infer_impl(self):
      """Performs inference on examples that require inference."""
      indices_to_infer = sorted(self.updated_example_indices)
      examples_to_infer = [
          self.json_to_proto(self.examples[index])
          for index in indices_to_infer
      ]
      infer_objs = []
      extra_output_objs = []
      serving_bundle = inference_utils.ServingBundle(
          self.config.get("inference_address"),
          self.config.get("model_name"),
          self.config.get("model_type"),
          self.config.get("model_version"),
          self.config.get("model_signature"),
          self.config.get("uses_predict_api"),
          self.config.get("predict_input_tensor"),
          self.config.get("predict_output_tensor"),
          self.estimator_and_spec.get("estimator"),
          self.estimator_and_spec.get("feature_spec"),
          self.custom_predict_fn,
      )
      (
          predictions,
          extra_output,
      ) = inference_utils.run_inference_for_inference_results(
          examples_to_infer, serving_bundle
      )
      infer_objs.append(predictions)
      extra_output_objs.append(extra_output)
      if (
          "inference_address_2" in self.config
          or self.compare_estimator_and_spec.get("estimator")
          or self.compare_custom_predict_fn
      ):
          serving_bundle = inference_utils.ServingBundle(
              self.config.get("inference_address_2"),
              self.config.get("model_name_2"),
              self.config.get("model_type"),
              self.config.get("model_version_2"),
              self.config.get("model_signature_2"),
              self.config.get("uses_predict_api"),
              self.config.get("predict_input_tensor"),
              self.config.get("predict_output_tensor"),
              self.compare_estimator_and_spec.get("estimator"),
              self.compare_estimator_and_spec.get("feature_spec"),
              self.compare_custom_predict_fn,
          )
          (
              predictions,
              extra_output,
          ) = inference_utils.run_inference_for_inference_results(
              examples_to_infer, serving_bundle
          )
          infer_objs.append(predictions)
          extra_output_objs.append(extra_output)
      self.updated_example_indices = set()
      return {
          "inferences": {
              "indices": indices_to_infer,
              "results": infer_objs,
          },
          "label_vocab": self.config.get("label_vocab"),
          "extra_outputs": extra_output_objs,
      }
  
imports: import base64
  import json
  import googleapiclient.discovery
  import os
  import logging
  import multiprocessing
  import tensorflow
  from IPython import display
  from google.protobuf import json_format
  from numbers import Number
  from oauth2client.client import GoogleCredentials
  from six import ensure_str
  from six import integer_types
  from utils import inference_utils
label_desc: Use image node_id 6 for calling the WitWidgetBase obj's underlying member method code with example usage: obj.infer_impl() and returns: dict