code: def unbatch_preds(
      preds: Union[Mapping[K, Sequence[V]], Sequence[dict[K, V]]]
  ) -> Iterable[dict[K, V]]:
      """Unbatch predictions, as in estimator.predict().
  
      Args:
        preds: dict[str, np.ndarray], where all arrays have the same first
          dimension.
  
      Yields:
        sequence of dict[str, np.ndarray], with the same keys as preds.
      """
      if not isinstance(preds, dict):
          for pred in preds:
              yield pred
      else:
          for i in range(_extract_batch_length(preds)):
              yield {key: value[i] for key, value in preds.items()}
  
imports: from collections.abc import Callable, Collection, Iterable, Iterator, Mapping, Sequence
  import itertools
  import queue
  import threading
  import time
  from typing import Any, Optional, TypeVar, Union
  import uuid
  from lit_nlp.api import types
  import numpy
label_desc: Use image node_id 13 for calling a global function with example usage: unbatch_preds(preds) without return types