class_docstr: Make async prediction requests to an Amazon SageMaker endpoint.
class_docstr_tok: ["Make","async","prediction","requests","to","an","Amazon","SageMaker","endpoint","."]
docstr: Wait and return the Async Inference result from the specified endpoint.
  
  Args:
      data (object): Input data for which you want the model to provide
          inference. If a serializer was specified in the encapsulated
          Predictor object, the result of the serializer is sent as input
          data. Otherwise the data must be sequence of bytes, and the
          predict method then sends the bytes in the request body as is.
      input_path (str): Amazon S3 URI contains input data for which you want
          the model to provide async inference. (Default: None)
      initial_args (dict[str,str]): Optional. Default arguments for boto3
          ``invoke_endpoint_async`` call. (Default: None).
      inference_id (str): If you provide a value, it is added to the captured data
          when you enable data capture on the endpoint (Default: None).
      waiter_config (sagemaker.async_inference.waiter_config.WaiterConfig): Configuration
          for the waiter. (Default: {"Delay": 15 seconds, "MaxAttempts": 60}
  Raises:
      ValueError: If both input data and input Amazon S3 path are not provided
  Returns:
      object: Inference for the given input. If a deserializer was specified when creating
          the Predictor, the result of the deserializer is
          returned. Otherwise the response returns the sequence of bytes
          as is.
docstr_tok: ["Wait","and","return","the","Async","Inference","result","from","the","specified","endpoint",".","Args",":","data","(","object",")",":","Input","data","for","which","you","want","the","model","to","provide","inference",".","If","a","serializer","was","specified","in","the","encapsulated","Predictor","object",",","the","result","of","the","serializer","is","sent","as","input","data",".","Otherwise","the","data","must","be","sequence","of","bytes",",","and","the","predict","method","then","sends","the","bytes","in","the","request","body","as","is",".","input_path","(","str",")",":","Amazon","S3","URI","contains","input","data","for","which","you","want","the","model","to","provide","async","inference",".","(","Default",":","None",")","initial_args","(","dict","[","str",",","str","]",")",":","Optional",".","Default","arguments","for","boto3","``","invoke_endpoint_async","``","call",".","(","Default",":","None",")",".","inference_id","(","str",")",":","If","you","provide","a","value",",","it","is","added","to","the","captured","data","when","you","enable","data","capture","on","the","endpoint","(","Default",":","None",")",".","waiter_config","(","sagemaker.async_inference.waiter_config.WaiterConfig",")",":","Configuration","for","the","waiter",".","(","Default",":","{","``","Delay","''",":","15","seconds",",","``","MaxAttempts","''",":","60","}","Raises",":","ValueError",":","If","both","input","data","and","input","Amazon","S3","path","are","not","provided","Returns",":","object",":","Inference","for","the","given","input",".","If","a","deserializer","was","specified","when","creating","the","Predictor",",","the","result","of","the","deserializer","is","returned",".","Otherwise","the","response","returns","the","sequence","of","bytes","as","is","."]
code: def predict(
      self,
      data=None,
      input_path=None,
      initial_args=None,
      inference_id=None,
      waiter_config=WaiterConfig(),
  ):
      """Wait and return the Async Inference result from the specified endpoint.
  
      Args:
          data (object): Input data for which you want the model to provide
              inference. If a serializer was specified in the encapsulated
              Predictor object, the result of the serializer is sent as input
              data. Otherwise the data must be sequence of bytes, and the
              predict method then sends the bytes in the request body as is.
          input_path (str): Amazon S3 URI contains input data for which you want
              the model to provide async inference. (Default: None)
          initial_args (dict[str,str]): Optional. Default arguments for boto3
              ``invoke_endpoint_async`` call. (Default: None).
          inference_id (str): If you provide a value, it is added to the captured data
              when you enable data capture on the endpoint (Default: None).
          waiter_config (sagemaker.async_inference.waiter_config.WaiterConfig): Configuration
              for the waiter. (Default: {"Delay": 15 seconds, "MaxAttempts": 60}
      Raises:
          ValueError: If both input data and input Amazon S3 path are not provided
      Returns:
          object: Inference for the given input. If a deserializer was specified when creating
              the Predictor, the result of the deserializer is
              returned. Otherwise the response returns the sequence of bytes
              as is.
      """
      if data is None and input_path is None:
          raise ValueError(
              "Please provide input data or input Amazon S3 location to use async prediction"
          )
      if data is not None:
          input_path = self._upload_data_to_s3(data, input_path)
  
      self._input_path = input_path
      response = self._submit_async_request(
          input_path, initial_args, inference_id
      )
      output_location = response["OutputLocation"]
      failure_location = response.get("FailureLocation")
      result = self._wait_for_output(
          output_path=output_location,
          failure_path=failure_location,
          waiter_config=waiter_config,
      )
  
      return result
  
imports: from __future__ import absolute_import
  import threading
  import time
  import uuid
  from botocore.exceptions import WaiterError
  from sagemaker import s3
  from sagemaker.exceptions import PollingTimeoutError, AsyncInferenceModelError
  from sagemaker.async_inference import WaiterConfig, AsyncInferenceResponse
  from sagemaker.s3 import parse_s3_url
  from sagemaker.session import Session
  from sagemaker.utils import name_from_base, sagemaker_timestamp, format_tags
label_desc: Use image node_id 2 for calling the AsyncPredictor obj's underlying member method code with example usage: obj.predict(data, input_path, initial_args, inference_id, waiter_config) and returns: result