code: def pandas_input_fn_for_saved_model(df, feat_name_type):
      """Pandas input function for TensorFlow SavedModel.
  
      Args:
          df (pandas.DataFrame): Data containing features.
          feat_name_type (dict): Feature name and type spec. E.g.
              `{'userID': int, 'itemID': int, 'rating': float}`
  
      Returns:
          func: Input function
  
      """
      for feat_type in feat_name_type.values():
          assert feat_type in (int, float, list)
  
      def input_fn():
          examples = [None] * len(df)
          for i, sample in df.iterrows():
              ex = tf.train.Example()
              for feat_name, feat_type in feat_name_type.items():
                  feat = ex.features.feature[feat_name]
                  if feat_type == int:
                      feat.int64_list.value.extend([sample[feat_name]])
                  elif feat_type == float:
                      feat.float_list.value.extend([sample[feat_name]])
                  elif feat_type == list:
                      feat.float_list.value.extend(sample[feat_name])
              examples[i] = ex.SerializeToString()
          return {"inputs": tf.constant(examples)}
  
      return input_fn
  
imports: import itertools
  import numpy
  import tensorflow
  from tensorflow_estimator.python.estimator.export.export import build_supervised_input_receiver_fn_from_input_fn
label_desc: Use image node_id 1 for calling a global function with example usage: pandas_input_fn_for_saved_model(df, feat_name_type) and returns: input_fn, dict