code: def load_label_mapping(mapping_file_path):
      """
      Load a JSON mapping { class ID -> friendly class name }.
      Used in BaseHandler.
      """
      if not os.path.isfile(mapping_file_path):
          logger.warning(
              "Missing the index_to_name.json file. Inference output will not include class name."
          )
          return None
  
      with open(mapping_file_path) as f:
          mapping = json.load(f)
      if not isinstance(mapping, dict):
          raise Exception(
              'index_to_name mapping should be in "class":"label" json format'
          )
  
      # Older examples had a different syntax than others. This code accommodates those.
      if "object_type_names" in mapping and isinstance(
          mapping["object_type_names"], list
      ):
          mapping = {
              str(k): v
              for k, v in enumerate(mapping["object_type_names"])
          }
          return mapping
  
      for key, value in mapping.items():
          new_value = value
          if isinstance(new_value, list):
              new_value = value[-1]
          if not isinstance(new_value, str):
              raise Exception(
                  "labels in index_to_name must be either str or [str]"
              )
          mapping[key] = new_value
      return mapping
  
file_path: serve/frontend/server/src/test/resources/densenet_workflow_handler.py
imports: import io
  import logging
  import os
  from PIL import Image
  import torch.nn.functional
  import torch
  import itertools
  import json
  from torchvision import transforms
label_desc: Use image node_id 3 for calling a global function with example usage: load_label_mapping(mapping_file_path) and returns: mapping, None, mapping