code: def infer_id_mappings_types(
      id_mappings: Union[Dict[str, Dict], Dict[str, pd.Series]]
  ) -> Dict:
      """
      Infer the data types in id_mappings.
  
      Parameters
      ----------
      id_mappings
          Id-to-content mappings. The contents can be text, image, etc.
  
      Returns
      -------
      A dictionary containing the data types in id_mappings.
      """
      id_mappings_types = collections.OrderedDict()
      if id_mappings is None:
          return id_mappings_types
  
      for per_name, per_id_mappings in id_mappings.items():
          if isinstance(per_id_mappings, dict):
              per_id_mappings = pd.Series(per_id_mappings.values())
          elif isinstance(per_id_mappings, pd.Series):
              pass
          else:
              raise ValueError(
                  f"Invalid per_id_mappings type: {type(per_id_mappings)}. Make sure the id_mappings is a dict of dicts or a dict of pd.Series."
              )
          if is_image_column(
              per_id_mappings, col_name=per_name, image_type=IMAGE_PATH
          ):
              id_mappings_types[per_name] = IMAGE_PATH
          elif is_text_column(per_id_mappings):
              id_mappings_types[per_name] = TEXT
          elif is_image_column(
              per_id_mappings,
              col_name=per_name,
              image_type=IMAGE_BYTEARRAY,
          ):
              id_mappings_types[per_name] = IMAGE_BYTEARRAY
          else:
              raise ValueError(
                  f"{per_name} in the id_mappings has an invalid type. Currently, we only support image and text types."
              )
      return id_mappings_types
  
imports: import collections
  import json
  import logging
  import warnings
  from io import BytesIO
  from typing import Dict, List, Optional, Tuple, Union
  import pandas
  import PIL
  import pytesseract
  from autogluon.core.utils import infer_problem_type
  from ..constants import BINARY, CATEGORICAL, CLASSIFICATION, DOCUMENT_IMAGE, DOCUMENT_PDF, IDENTIFIER, IMAGE, IMAGE_BYTEARRAY, IMAGE_PATH, MULTICLASS, NER, NER_ANNOTATION, NULL, NUMERICAL, OBJECT_DETECTION, OPEN_VOCABULARY_OBJECT_DETECTION, REGRESSION, ROIS, SEMANTIC_SEGMENTATION, SEMANTIC_SEGMENTATION_GT, SEMANTIC_SEGMENTATION_IMG, TEXT, TEXT_NER
  from .utils import is_rois_input
label_desc: Use image node_id 9 for calling a global function with example usage: infer_id_mappings_types(id_mappings) and returns: id_mappings_types, id_mappings_types