code: def load_predictor(
      fpath, batch_size=U.DEFAULT_BS, custom_objects=None
  ):
      """
      ```
      Loads a previously saved Predictor instance
      Args
        fpath(str): predictor path name (value supplied to predictor.save)
                    From v0.16.x, this is always the path to a folder.
                    Pre-v0.16.x, this is the base name used to save model and .preproc instance.
        batch_size(int): batch size to use for predictions. default:32
        custom_objects(dict): custom objects required to load model.
                              This is useful if you compiled the model with a custom loss function, for example.
                              For models included with ktrain as is, this is populated automatically
                              and can be disregarded.
      ```
      """
  
      # load the preprocessor
      preproc = None
      try:
          preproc_name = os.path.join(fpath, U.PREPROC_NAME)
          with open(preproc_name, "rb") as f:
              preproc = pickle.load(f)
      except:
          try:
              preproc_name = fpath + ".preproc"
              # warnings.warn('could not load .preproc file as %s - attempting to load as %s' % (os.path.join(fpath, U.PREPROC_NAME), preproc_name))
              with open(preproc_name, "rb") as f:
                  preproc = pickle.load(f)
          except:
              raise Exception(
                  "Failed to load .preproc file in either the post v0.16.x loction (%s) or pre v0.16.x location (%s)"
                  % (
                      os.path.join(fpath, U.PREPROC_NAME),
                      fpath + ".preproc",
                  )
              )
  
      # load the model
      model = _load_model(
          fpath, preproc=preproc, custom_objects=custom_objects
      )
  
      # preprocessing functions in ImageDataGenerators are not pickable
      # so, we must reconstruct
      if hasattr(preproc, "datagen") and hasattr(
          preproc.datagen, "ktrain_preproc"
      ):
          preproc_name = preproc.datagen.ktrain_preproc
          if preproc_name == "resnet50":
              preproc.datagen.preprocessing_function = (
                  keras.applications.resnet50.preprocess_input
              )
          elif preproc_name == "mobilenet":
              preproc.datagen.preprocessing_function = (
                  keras.applications.mobilenet.preprocess_input
              )
          elif preproc_name == "mobilenetv3":
              preproc.datagen.preprocessing_function = (
                  keras.applications.mobilenet_v3.preprocess_input
              )
          elif preproc_name == "inception":
              preproc.datagen.preprocessing_function = (
                  keras.applications.inception_v3.preprocess_input
              )
          elif preproc_name == "efficientnet":
              preproc.datagen.preprocessing_function = (
                  keras.applications.efficientnet.preprocess_input
              )
          else:
              raise Exception(
                  "Uknown preprocessing_function name: %s"
                  % (preproc_name)
              )
  
      # return the appropriate predictor
      if not isinstance(model, keras.Model):
          raise ValueError("model must be of instance keras.Model")
      if not isinstance(
          preproc,
          (
              ImagePreprocessor,
              TextPreprocessor,
              NERPreprocessor,
              NodePreprocessor,
              LinkPreprocessor,
              TabularPreprocessor,
          ),
      ):
          raise ValueError(
              "preproc must be instance of ktrain.preprocessor.Preprocessor"
          )
      if isinstance(preproc, ImagePreprocessor):
          return ImagePredictor(model, preproc, batch_size=batch_size)
      elif isinstance(preproc, TextPreprocessor):
          return TextPredictor(model, preproc, batch_size=batch_size)
      elif isinstance(preproc, NERPreprocessor):
          return NERPredictor(model, preproc, batch_size=batch_size)
      elif isinstance(preproc, NodePreprocessor):
          return NodePredictor(model, preproc, batch_size=batch_size)
      elif isinstance(preproc, LinkPreprocessor):
          return LinkPredictor(model, preproc, batch_size=batch_size)
      elif isinstance(preproc, TabularPreprocessor):
          return TabularPredictor(model, preproc, batch_size=batch_size)
      else:
          raise Exception("preprocessor not currently supported")
  
imports: from .None import utils
  from .graph.predictor import LinkPredictor, NodePredictor
  from .graph.preprocessor import LinkPreprocessor, NodePreprocessor
  from .imports import *
  from .lroptimize.lrfinder import *
  from .tabular.predictor import TabularPredictor
  from .tabular.preprocessor import TabularPreprocessor
  from .text.ner.predictor import NERPredictor
  from .text.ner.preprocessor import NERPreprocessor
  from .text.predictor import TextPredictor
  from .text.preprocessor import BERTPreprocessor, TextPreprocessor, TransformersPreprocessor
  from .vision.predictor import ImagePredictor
  from .vision.preprocessor import ImagePreprocessor
label_desc: Use image node_id 2 for calling a global function with example usage: load_predictor(fpath, batch_size, custom_objects) and returns: ImagePredictor, TextPredictor, NERPredictor, NodePredictor, LinkPredictor, TabularPredictor