class_docstr: LIT WSGI application.
class_docstr_tok: ["LIT","WSGI","application","."]
docstr: Run an interpretation component.
code: def _get_interpretations(
      self,
      data: types.JsonDict,
      model: Optional[str] = None,
      dataset_name: Optional[str] = None,
      interpreter: Optional[str] = None,
      # boolean but via URL param, so encoding as "0" /  "1" is safer.
      do_predict: str = "1",
      **unused_kw,
  ):
      """Run an interpretation component."""
      if dataset_name is None:
          raise ValueError(
              'Must provide a "dataset_name" to get examples.'
          )
      if interpreter is None:
          raise ValueError(
              'Must provide a "interpreter" name to interpret preds.'
          )
      if model is None:
          raise ValueError(
              'Must provide a "model" name to get predictions.'
          )
  
      interp: lit_components.Interpreter = self._interpreters[
          interpreter
      ]
      mdl: lit_model.Model = self._models[model]
  
      config_spec: types.Spec = interp.config_spec()
      config: Optional[types.JsonDict] = data.get("config")
      if config_spec and config is not None:
          utils.validate_config_against_spec(
              config,
              config_spec,
              f"{interpreter} ({type(interp).__name__})",
          )
  
      model_inputs = [ex["data"] for ex in data["inputs"]]
  
      # Get model preds before the interpreter call. Usually these are cached.
      # TODO(b/278586715): See if we can remove this path and just allow
      # interpreters to call the model directly.
      if utils.coerce_bool(do_predict):
          # Workaround so that interpreters can skip the predict() call when it
          # is unnecessary and may be slow.
          # TODO(b/278586715): Remove this once we can ensure that model_outputs
          # can be removed from the Interpreter API.
          model_outputs = list(mdl.predict(model_inputs))
          assert len(model_outputs) == len(model_inputs)
      else:
          model_outputs = None
  
      return interp.run(
          model_inputs,
          mdl,
          self._datasets[dataset_name],
          model_outputs=model_outputs,
          config=data.get("config"),
      )
  
imports: from collections.abc import Callable, Iterable, Mapping, Sequence
  import functools
  import glob
  import math
  import os
  import random
  import threading
  import time
  from typing import Any, Optional, TypedDict, Union
  from absl import logging
  from lit_nlp.api import components
  from lit_nlp.api import dataset
  from lit_nlp.api import layout
  from lit_nlp.api import model
  from lit_nlp.api import types
  from lit_nlp.components import core
  from lit_nlp.lib import caching
  from lit_nlp.lib import flag_helpers
  from lit_nlp.lib import serialize
  from lit_nlp.lib import ui_state
  from lit_nlp.lib import utils
  from lit_nlp.lib import validation
  from lit_nlp.lib import wsgi_app
  import tqdm
label_desc: Use image node_id 16 for calling the LitApp obj's underlying member method code with example usage: obj._get_interpretations(data, model, dataset_name, interpreter, do_predict) and returns: interp