code: def _inputs_to_serialized_example(input_dict: lit_types.JsonDict):
      """Converts the input dictionary to a serialized tf example."""
      feature_dict = {}
      for k, v in input_dict.items():
          if not isinstance(v, list):
              v = [v]
          if isinstance(v[0], int):
              feature_dict[k] = tf.train.Feature(
                  int64_list=tf.train.Int64List(value=v)
              )
          elif isinstance(v[0], float):
              feature_dict[k] = tf.train.Feature(
                  float_list=tf.train.FloatList(value=v)
              )
          else:
              feature_dict[k] = tf.train.Feature(
                  bytes_list=tf.train.BytesList(
                      value=[bytes(i, "utf-8") for i in v]
                  )
              )
      result = tf.train.Example(
          features=tf.train.Features(feature=feature_dict)
      )
      return result.SerializeToString()
  
file_path: lit/lit_nlp/components/tfx_model.py
imports: from collections.abc import Iterator
  import attr
  from lit_nlp.api import model
  from lit_nlp.api import types
  import tensorflow
  import tensorflow_text
label_desc: Use image node_id 1 for calling a global function with example usage: _inputs_to_serialized_example(input_dict) and returns: result