Perform an online prediction. The prediction result will be directly
        returned in the response. Available for following ML problems, and their
        expected request payloads:

        -  Image Classification - Image in .JPEG, .GIF or .PNG format,
           image\_bytes up to 30MB.
        -  Image Object Detection - Image in .JPEG, .GIF or .PNG format,
           image\_bytes up to 30MB.
        -  Text Classification - TextSnippet, content up to 10,000 characters,
           UTF-8 encoded.
        -  Text Extraction - TextSnippet, content up to 30,000 characters, UTF-8
           NFC encoded. \* Translation - TextSnippet, content up to 25,000
           characters, UTF-8 encoded.
        -  Tables - Row, with column values matching the columns of the model,
           up to 5MB.
        -  Text Sentiment - TextSnippet, content up 500 characters, UTF-8
           encoded.

        Example:
            >>> from google.cloud import automl_v1beta1
            >>>
            >>> client = automl_v1beta1.PredictionServiceClient()
            >>>
            >>> name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]')
            >>>
            >>> # TODO: Initialize `payload`:
            >>> payload = {}
            >>>
            >>> response = client.predict(name, payload)

        Args:
            name (str): Name of the model requested to serve the prediction.
            payload (Union[dict, ~google.cloud.automl_v1beta1.types.ExamplePayload]): Required.
                Payload to perform a prediction on. The payload must match the
                problem type that the model was trained to solve.

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.automl_v1beta1.types.ExamplePayload`
            params (dict[str -> str]): Additional domain-specific parameters, any string must be up to 25000
                characters long.

                -  For Image Classification:

                   ``score_threshold`` - (float) A value from 0.0 to 1.0. When the model
                   makes predictions for an image, it will only produce results that
                   have at least this confidence score. The default is 0.5.

                -  For Image Object Detection: ``score_threshold`` - (float) When Model
                   detects objects on the image, it will only produce bounding boxes
                   which have at least this confidence score. Value in 0 to 1 range,
                   default is 0.5. ``max_bounding_box_count`` - (int64) No more than
                   this number of bounding boxes will be returned in the response.
                   Default is 100, the requested value may be limited by server.
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.
            metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                that is provided to the method.

        Returns:
            A :class:`~google.cloud.automl_v1beta1.types.PredictResponse` instance.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.

def predict(
        self,
        name,
        payload,
        params=None,
        retry=google.api_core.gapic_v1.method.DEFAULT,
        timeout=google.api_core.gapic_v1.method.DEFAULT,
        metadata=None,
    ):
        """
        Perform an online prediction. The prediction result will be directly
        returned in the response. Available for following ML problems, and their
        expected request payloads:

        -  Image Classification - Image in .JPEG, .GIF or .PNG format,
           image\_bytes up to 30MB.
        -  Image Object Detection - Image in .JPEG, .GIF or .PNG format,
           image\_bytes up to 30MB.
        -  Text Classification - TextSnippet, content up to 10,000 characters,
           UTF-8 encoded.
        -  Text Extraction - TextSnippet, content up to 30,000 characters, UTF-8
           NFC encoded. \* Translation - TextSnippet, content up to 25,000
           characters, UTF-8 encoded.
        -  Tables - Row, with column values matching the columns of the model,
           up to 5MB.
        -  Text Sentiment - TextSnippet, content up 500 characters, UTF-8
           encoded.

        Example:
            >>> from google.cloud import automl_v1beta1
            >>>
            >>> client = automl_v1beta1.PredictionServiceClient()
            >>>
            >>> name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]')
            >>>
            >>> # TODO: Initialize `payload`:
            >>> payload = {}
            >>>
            >>> response = client.predict(name, payload)

        Args:
            name (str): Name of the model requested to serve the prediction.
            payload (Union[dict, ~google.cloud.automl_v1beta1.types.ExamplePayload]): Required.
                Payload to perform a prediction on. The payload must match the
                problem type that the model was trained to solve.

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.automl_v1beta1.types.ExamplePayload`
            params (dict[str -> str]): Additional domain-specific parameters, any string must be up to 25000
                characters long.

                -  For Image Classification:

                   ``score_threshold`` - (float) A value from 0.0 to 1.0. When the model
                   makes predictions for an image, it will only produce results that
                   have at least this confidence score. The default is 0.5.

                -  For Image Object Detection: ``score_threshold`` - (float) When Model
                   detects objects on the image, it will only produce bounding boxes
                   which have at least this confidence score. Value in 0 to 1 range,
                   default is 0.5. ``max_bounding_box_count`` - (int64) No more than
                   this number of bounding boxes will be returned in the response.
                   Default is 100, the requested value may be limited by server.
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.
            metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                that is provided to the method.

        Returns:
            A :class:`~google.cloud.automl_v1beta1.types.PredictResponse` instance.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.
        """
        # Wrap the transport method to add retry and timeout logic.
        if "predict" not in self._inner_api_calls:
            self._inner_api_calls[
                "predict"
            ] = google.api_core.gapic_v1.method.wrap_method(
                self.transport.predict,
                default_retry=self._method_configs["Predict"].retry,
                default_timeout=self._method_configs["Predict"].timeout,
                client_info=self._client_info,
            )

        request = prediction_service_pb2.PredictRequest(
            name=name, payload=payload, params=params
        )
        if metadata is None:
            metadata = []
        metadata = list(metadata)
        try:
            routing_header = [("name", name)]
        except AttributeError:
            pass
        else:
            routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
                routing_header
            )
            metadata.append(routing_metadata)

        return self._inner_api_calls["predict"](
            request, retry=retry, timeout=timeout, metadata=metadata
        )