class_docstr: Image classification model with embedded pre-processing.
  
  This class is essentially an MLflow custom python function wrapper around a Keras model.
  The wrapper provides image preprocessing so that the model can be applied to images directly.
  The input to the model is base64 encoded image binary data (e.g. contents of a jpeg file).
  The output is the predicted class label, predicted class id followed by probabilities for each
  class.
  
  The model declares current local versions of Keras, Tensorlow and pillow as dependencies in its
  conda environment file.
docstr: Generate predictions for the data.
  
  :param input: pandas.DataFrame with one column containing images to be scored. The image
               column must contain base64 encoded binary content of the image files. The image
               format must be supported by PIL (e.g. jpeg or png).
  :param params: Additional parameters to pass to the model for inference.
  
                 .. Note:: Experimental: This parameter may change or be removed in a future
                                         release without warning.
  
  :return: pandas.DataFrame containing predictions with the following schema:
               Predicted class: string,
               Predicted class index: int,
               Probability(class==0): float,
               ...,
               Probability(class==N): float,
docstr_tok: ["Generate","predictions","for","the","data",".",":","param","input",":","pandas.DataFrame","with","one","column","containing","images","to","be","scored",".","The","image","column","must","contain","base64","encoded","binary","content","of","the","image","files",".","The","image","format","must","be","supported","by","PIL","(","e.g",".","jpeg","or","png",")",".",":","param","params",":","Additional","parameters","to","pass","to","the","model","for","inference",".","..","Note",":",":","Experimental",":","This","parameter","may","change","or","be","removed","in","a","future","release","without","warning",".",":","return",":","pandas.DataFrame","containing","predictions","with","the","following","schema",":","Predicted","class",":","string",",","Predicted","class","index",":","int",",","Probability","(","class==0",")",":","float",",","...",",","Probability","(","class==N",")",":","float",","]
code: def predict(
      self,
      input,
      params: Optional[
          Dict[str, Any]
      ] = None,  # pylint: disable=unused-argument
  ):
      """
      Generate predictions for the data.
  
      :param input: pandas.DataFrame with one column containing images to be scored. The image
                   column must contain base64 encoded binary content of the image files. The image
                   format must be supported by PIL (e.g. jpeg or png).
      :param params: Additional parameters to pass to the model for inference.
  
                     .. Note:: Experimental: This parameter may change or be removed in a future
                                             release without warning.
  
      :return: pandas.DataFrame containing predictions with the following schema:
                   Predicted class: string,
                   Predicted class index: int,
                   Probability(class==0): float,
                   ...,
                   Probability(class==N): float,
      """
  
      # decode image bytes from base64 encoding
      def decode_img(x):
          return pd.Series(
              base64.decodebytes(bytearray(x[0], encoding="utf8"))
          )
  
      images = input.apply(axis=1, func=decode_img)
      probs = self._predict_images(images)
      m, n = probs.shape
      label_idx = np.argmax(probs, axis=1)
      labels = np.array(
          [self._domain[i] for i in label_idx], dtype=str
      ).reshape(m, 1)
      output_data = np.concatenate(
          (labels, label_idx.reshape(m, 1), probs), axis=1
      )
      res = pd.DataFrame(columns=self._column_names, data=output_data)
      res.index = input.index
      return res
  
imports: import base64
  import os
  from io import BytesIO
  from typing import Any, Dict, Optional
  import keras
  import numpy
  import pandas
  import PIL
  import pip
  import tensorflow
  import yaml
  from PIL import Image
  import mlflow
  from mlflow.utils import PYTHON_VERSION
  from mlflow.utils.file_utils import TempDir
label_desc: Use image node_id 2 for calling the KerasImageClassifierPyfunc obj's underlying member method code with example usage: obj.predict(input, params) and returns: res, pd