code: def _apply_models(
      model_names,
      batch_size=None,
      confidence_thresh=None,
      pass_confidence_thresh=False,
      max_samples=10,
      model_kwargs=None,
      apply_kwargs=None,
  ):
      if pass_confidence_thresh:
          kwargs = {"confidence_thresh": confidence_thresh}
      else:
          kwargs = {}
  
      if apply_kwargs:
          kwargs.update(apply_kwargs)
  
      dataset = foz.load_zoo_dataset(
          "coco-2017",
          split="validation",
          dataset_name=fo.get_default_dataset_name(),
          shuffle=True,
          max_samples=max_samples,
      )
  
      # Generate keypoints for segment-anything model
      if _SAM_PROMPT_FIELD in kwargs:
          field_name = kwargs[_SAM_PROMPT_FIELD]
          kp_field_name = field_name + "_points"
          detections = dataset.values(field_name + ".detections")
          keypoints = [_detections_to_keypoints(d) for d in detections]
          dataset.set_values(kp_field_name, keypoints)
          kwargs[_SAM_PROMPT_FIELD] = kp_field_name
  
      for idx, model_name in enumerate(model_names, 1):
          print(
              "Running model %d/%d: '%s'"
              % (idx, len(model_names), model_name)
          )
  
          model = foz.load_zoo_model(model_name, **(model_kwargs or {}))
  
          label_field = (
              model_name.lower().replace("-", "_").replace(".", "_")
          )
  
          dataset.apply_model(
              model,
              label_field=label_field,
              batch_size=batch_size,
              **kwargs,
          )
  
      session = fo.launch_app(dataset)
      session.wait()
  
imports: import random
  import unittest
  import fiftyone
  import fiftyone.zoo
  from fiftyone import ViewField
label_desc: Use image node_id 19 for calling a global function with example usage: _apply_models(model_names, batch_size, confidence_thresh, pass_confidence_thresh, max_samples, model_kwargs, apply_kwargs) without return types