code: def _encode(inputs, encoder, add_eos=True):
      input_ids = encoder.encode(inputs)
      if add_eos:
          input_ids.append(text_encoder.EOS_ID)
      return input_ids
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import base64
  import functools
  from googleapiclient import discovery
  import grpc
  import numpy
  from tensor2tensor import problems
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.utils import cloud_mlengine
  from tensor2tensor.utils import contrib
  import tensorflow.compat.v1
  from tensorflow_serving.apis import predict_pb2
  from tensorflow_serving.apis import prediction_service_pb2_grpc
label_desc: Use image node_id 3 for calling a global function with example usage: _encode(inputs, encoder, add_eos) and returns: input_ids