code: def initialize_model(model_name):
      # load model
      if model_name not in MODEL_CACHE:
          if ".nemo" in model_name:
              # use local model
              model_name_no_ext = os.path.splitext(model_name)[0]
              model_path = os.path.join(
                  "models", model_name_no_ext, model_name
              )
  
              # Extract config
              model_cfg = nemo_asr.models.ASRModel.restore_from(
                  restore_path=model_path, return_config=True
              )
              classpath = model_cfg.target  # original class path
              imported_class = model_utils.import_class_by_path(
                  classpath
              )  # type: ASRModel
              logging.info(
                  f"Restoring local model : {imported_class.__name__}"
              )
  
              # load model from checkpoint
              model = imported_class.restore_from(
                  restore_path=model_path, map_location="cpu"
              )  # type: ASRModel
  
          else:
              # use pretrained model
              model = nemo_asr.models.ASRModel.from_pretrained(
                  model_name, map_location="cpu"
              )
  
          model.freeze()
  
          # cache model
          MODEL_CACHE[model_name] = model
  
      model = MODEL_CACHE[model_name]
      return model
  
file_path: NeMo/tools/asr_webapp/model_api.py
imports: import contextlib
  import glob
  import os
  import torch
  import nemo.collections.asr
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 2 for calling a global function with example usage: initialize_model(model_name) and returns: model