code: def run(
      model: str,
      images: Optional[
          BatchInferImageType
      ] = BatchInferImageType.IMAGES_ALL,
      params: Optional[dict] = None,
      run_sync: Optional[bool] = False,
  ):
      request = {"model": model, "images": images}
      res, detail = AsyncTask.run(
          "batch_infer",
          request=request,
          params=params,
          force_sync=run_sync,
      )
      if res is None:
          raise HTTPException(status_code=429, detail=detail)
      return res
  
file_path: MONAILabel/monailabel/endpoints/batch_infer.py
imports: import logging
  from typing import Optional
  import torch
  from fastapi import APIRouter, Depends, HTTPException
  from monailabel.config import RBAC_ADMIN, RBAC_USER, settings
  from monailabel.endpoints.user.auth import RBAC, User
  from monailabel.interfaces.datastore import DefaultLabelTag
  from monailabel.interfaces.tasks.batch_infer import BatchInferImageType
  from monailabel.utils.async_tasks.task import AsyncTask
label_desc: Use image node_id 2 for calling a global function with example usage: run(model, images, params, run_sync) and returns: res