code: def createModelWithSingleInput(self, save_as_keras):
      input_layer = tf.keras.layers.Input(shape=(1,), name="input")
      output_layer = tf.keras.layers.Dense(1, activation=tf.nn.sigmoid)(
          input_layer
      )
      model = tf.keras.models.Model(input_layer, output_layer)
  
      @tf.function
      def serving_default(s):
          return model(s)
  
      input_spec = {
          "input": tf.TensorSpec(
              shape=(None, 1), dtype=tf.string, name="input"
          ),
      }
      signatures = {
          "serving_default": serving_default.get_concrete_function(
              input_spec
          ),
          "custom_signature": serving_default.get_concrete_function(
              input_spec
          ),
      }
  
      export_path = tempfile.mkdtemp()
      if save_as_keras:
          model.save(
              export_path, save_format="tf", signatures=signatures
          )
      else:
          tf.saved_model.save(model, export_path, signatures=signatures)
      return export_path
  
imports: import tempfile
  import unittest
  from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import model_util
  from tensorflow_model_analysis.utils import util
  from tfx_bsl.tfxio import tf_example_record
  from google.protobuf import text_format
  from tensorflow.core.protobuf import saved_model_pb2
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 2 for calling the ModelUtilTest obj's underlying member method code with example usage: obj.createModelWithSingleInput(save_as_keras) and returns: export_path, model