code: def _predict_fn(
      strings: Iterable[str],
      model: Any,
      original_example: JsonDict,
      text_key: str,
      pred_key: str,
      pred_type_info: types.LitType,
  ):
      """Given raw strings, return scores. Used by `lime.explain`.
  
      Adjust the `original_example` by changing the value of the field `text_key`
      by the values in `strings`, and run model prediction on each adjusted example,
      returning a list of scores, one entry per adjusted example.
  
      Args:
        strings: The adjusted strings to set in the original example.
        model: The model to run.
        original_example: The original example to adjust.
        text_key: The field in which to adjust the original example with the
          provided strings.
        pred_key: The key to the model's output field to explain.
        pred_type_info: The `LitType` value for the model's output field to explain.
  
      Returns:
        A list of scores for the model output on the adjusted examples. For
        regression tasks, a 1D list of values. For classification and multi-label,
        a 2D list, where each entry is a list of scores for each possible label,
        in order by the class index.
      """
      # Prepare example objects to be fed to the model for each sentence/string.
      model_inputs = [
          utils.make_modified_input(
              original_example, {text_key: s}, "LIME"
          )
          for s in strings
      ]
  
      # Get model predictions for the examples.
      model_outputs = model.predict(model_inputs)
      outputs = [output[pred_key] for output in model_outputs]
      if isinstance(pred_type_info, types.SparseMultilabelPreds):
          assert (
              pred_type_info.vocab
          ), f"No vocab found for {pred_key} field. Cannot use LIME."
          # Convert list of class/score tuples to a list of scores for each possible
          # class, in class index order.
          output_arr = np.zeros(
              [len(outputs), len(pred_type_info.vocab)]
          )
          for i, pred in enumerate(outputs):
              for p in pred:
                  class_idx = pred_type_info.vocab.index(p[0])
                  output_arr[i, class_idx] = p[1]
  
          outputs = output_arr
      else:
          # Make outputs 1D in case of regression or binary classification.
          # <float32>[len(strings)] or <float32>[len(strings), num_labels].
          outputs = np.array(outputs)
          if outputs.ndim == 2 and outputs.shape[1] == 1:
              outputs = np.squeeze(outputs, axis=1)
      return outputs
  
imports: from collections.abc import Iterable
  import functools
  from typing import Any, Optional
  from absl import logging
  from lit_nlp.api import components
  from lit_nlp.api import dataset
  from lit_nlp.api import dtypes
  from lit_nlp.api import model
  from lit_nlp.api import types
  from lit_nlp.components.citrus import lime
  from lit_nlp.components.citrus import utils
  from lit_nlp.lib import utils
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _predict_fn(strings, model, original_example, text_key, pred_key, pred_type_info) and returns: outputs