def execute()

in templates/inference-endpoints/preprocessing/1/model.py [0:0]


    def execute(self, requests: Sequence):
        """`execute` must be implemented in every Python model. `execute`
        function receives a list of pb_utils.InferenceRequest as the only
        argument. This function is called when an inference is requested
        for this model. Depending on the batching configuration (e.g. Dynamic
        Batching) used, `requests` may contain multiple requests. Every
        Python model, must create one pb_utils.InferenceResponse for every
        pb_utils.InferenceRequest in `requests`. If there is an error, you can
        set the error argument when creating a pb_utils.InferenceResponse.
        Parameters
        ----------
        requests : list
          A list of pb_utils.InferenceRequest
        Returns
        -------
        list
          A list of pb_utils.InferenceResponse. The length of this list must be the same as `requests`
        """
        responses = []

        # Every Python backend must iterate over every request
        # and create a pb_utils.InferenceResponse for each of them.
        for request in requests:
            response = self.handle_request(request)
            responses.append(response)

        # You should return a list of pb_utils.InferenceResponse. Length
        # of this list must match the length of `requests` list.
        return responses