code: def output_fn(prediction, accept):
      pred_array_value = np.array(prediction)
      score = pred_array_value[0]
  
      if accept == "application/json":
          predicted_label = 1 if score > 0.5 else 0
          return_value = {
              "predictions": [
                  {
                      "score": score.astype(float),
                      "predicted_label": predicted_label,
                  }
              ]
          }
          return worker.Response(
              json.dumps(return_value), mimetype=accept
          )
      elif accept == "text/csv":
          return_value = "yes" if score > 0.5 else "no"
          return worker.Response(
              encoders.encode(prediction, accept), mimetype=accept
          )
      else:
          raise RuntimeException(
              "{} accept type is not supported.".format(accept)
          )
  
file_path: sagemaker-python-sdk/tests/data/sip/xgboost_source_dir/inference.py
imports: import os
  import pickle
  import json
  import numpy
  import xgboost
  from sagemaker_containers.beta.framework import content_types, encoders, env, modules, transformer, worker
  from sagemaker_xgboost_container import encoder
label_desc: Use image node_id 3 for calling a global function with example usage: output_fn(prediction, accept) and returns: worker, worker