code: def infer_scarcity_mode_by_data_size(
      df_train: pd.DataFrame, scarcity_threshold: int = 50
  ):
      """
      Infer based on the number of training sample the data scarsity. Select mode accordingly from [DEFAULT_SHOT, FEW_SHOT, ZERO_SHOT].
  
      Parameters
      ---------------
      df_train
          Training dataframe
      scarcity_threshold
          Threshold number of samples when to select FEW_SHOT mode
  
      Returns
      --------
      Mode in  [DEFAULT_SHOT, FEW_SHOT, ZERO_SHOT]
      """
      row_num = len(df_train)
      if row_num < scarcity_threshold:
          return FEW_SHOT
      else:
          return DEFAULT_SHOT
  
imports: import copy
  import logging
  import os
  import warnings
  from typing import Dict, List, Optional, Tuple, Union
  import pandas
  from omegaconf import DictConfig, OmegaConf
  from torch import nn
  from autogluon.core.utils import default_holdout_frac, generate_train_test_split_combined
  from autogluon.core.utils.loaders import load_pd
  from ..constants import BINARY, CATEGORICAL, DEFAULT_SHOT, DOCUMENT, FEW_SHOT, IMAGE, IMAGE_PATH, LABEL, MMLAB_MODELS, MULTICLASS, NER, NER_ANNOTATION, NER_TEXT, NUMERICAL, OVD, REGRESSION, ROIS, SAM, SEMANTIC_SEGMENTATION_IMG, TEXT, TEXT_NER
  from ..data import CategoricalProcessor, DocumentProcessor, ImageProcessor, LabelProcessor, MixupModule, MMDetProcessor, MMOcrProcessor, MultiModalFeaturePreprocessor, NerLabelEncoder, NerProcessor, NumericalProcessor, OVDProcessor, SemanticSegImageProcessor, TextProcessor
  from ..data.infer_types import is_image_column
label_desc: Use image node_id 8 for calling a global function with example usage: infer_scarcity_mode_by_data_size(df_train, scarcity_threshold) and returns: FEW_SHOT, DEFAULT_SHOT