code: def preprocessing_fn(inputs):
      """tf.transform's callback function for preprocessing inputs.
  
      Args:
        inputs: map from feature keys to raw not-yet-transformed features.
  
      Returns:
        Map from string feature key to transformed feature operations.
      """
      outputs = {}
  
      # tf.io.decode_png function cannot be applied on a batch of data.
      # We have to use tf.map_fn
      image_features = tf.map_fn(
          lambda x: tf.io.decode_png(x[0], channels=3),
          inputs[_IMAGE_KEY],
          dtype=tf.uint8,
      )
      # image_features = tf.cast(image_features, tf.float32)
      image_features = tf.image.resize(image_features, [224, 224])
      image_features = tf.keras.applications.mobilenet.preprocess_input(
          image_features
      )
  
      outputs[_transformed_name(_IMAGE_KEY)] = image_features
      # TODO(b/157064428): Support label transformation for Keras.
      # Do not apply label transformation as it will result in wrong evaluation.
      outputs[_transformed_name(_LABEL_KEY)] = inputs[_LABEL_KEY]
  
      return outputs
  
imports: import os
  from typing import List
  import absl
  import flatbuffers
  import tensorflow
  import tensorflow_transform
  from tfx.components.trainer.fn_args_utils import DataAccessor
  from tfx.components.trainer.fn_args_utils import FnArgs
  from tfx.components.trainer.rewriting import converters
  from tfx.components.trainer.rewriting import rewriter
  from tfx.components.trainer.rewriting import rewriter_factory
  from tfx.dsl.io import fileio
  from tfx_bsl.tfxio import dataset_options
  from tflite_support import metadata_schema_py_generated
  from tflite_support import metadata
label_desc: Use image node_id 8 for calling a global function with example usage: preprocessing_fn(inputs) and returns: outputs