code: def create_classifier(
      base_model_fn: callable,
      num_classes: int,
      weights="imagenet",
      dropout: Optional[float] = None,
      include_top=False,
  ):
      base_model = base_model_fn(
          include_top=include_top,
          weights=weights,
      )
      if include_top:
          return base_model
  
      outputs = 1 if num_classes == 2 else num_classes
  
      x = base_model.output
      x = tf.keras.layers.GlobalMaxPool2D()(x)
      if dropout:
          x = tf.keras.layers.Dropout(dropout)(x)
      x = tf.keras.layers.Dense(outputs, name="output")(x)
  
      model = tf.keras.Model(base_model.input, x)
      return model
  
imports: import inspect
  from functools import partial
  from typing import Any, List, Optional, Union
  import matplotlib.cm
  import matplotlib.pyplot
  import numpy
  import tensorflow
  import tensorflow_addons
  from PIL import Image
  from tensorflow import keras
  from tensorflow.keras.models import Model
  from tf_keras_vis.gradcam import Gradcam, GradcamPlusPlus
  from tf_keras_vis.utils import normalize
  from typeguard import check_argument_types, typechecked
  from chitra.import_utils import is_installed
  from .datagenerator import Dataset
label_desc: Use image node_id 3 for calling a global function with example usage: create_classifier(base_model_fn, num_classes, weights, dropout, include_top) and returns: model, base_model