code: def preprocessing_fn(inputs):
      """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 = inputs.copy()
  
      # Compute a vocabulary based on the TOP-K current pages and labels seen in
      # the dataset.
      vocab = tft.vocabulary(
          tf.concat(
              [inputs[_CUR_PAGE_FEATURE_KEY], inputs[_LABEL_KEY]],
              axis=0,
          ),
          top_k=_TOP_K,
          vocab_filename=_VOCAB_FILENAME,
      )
  
      # Apply the vocabulary to both the current page feature and the label,
      # converting the strings into integers.
      for k in [_CUR_PAGE_FEATURE_KEY, _LABEL_KEY]:
          # Out-of-vocab strings will be assigned the _TOP_K value.
          outputs[k] = tft.apply_vocabulary(
              inputs[k], vocab, default_value=_TOP_K
          )
      return outputs
  
file_path: tfx/tfx/examples/tfjs_next_page_prediction/tfjs_next_page_prediction_util.py
imports: import os
  from typing import List
  import absl
  import tensorflow
  from tensorflow import keras
  import tensorflow_transform
  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 import v1
  from tfx_bsl.public import tfxio
label_desc: Use image node_id 1 for calling a global function with example usage: preprocessing_fn(inputs) and returns: outputs