Class Handler (1.35.0)

  Handler 
 ( 
 artifacts_uri 
 : 
 str 
 , 
 predictor 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Type 
 [ 
 google 
 . 
 cloud 
 . 
 aiplatform 
 . 
 prediction 
 . 
 predictor 
 . 
 Predictor 
 ] 
 ] 
 = 
 None 
 , 
 ) 
 

Interface for Handler class to handle prediction requests.

Methods

Handler

  Handler 
 ( 
 artifacts_uri 
 : 
 str 
 , 
 predictor 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Type 
 [ 
 google 
 . 
 cloud 
 . 
 aiplatform 
 . 
 prediction 
 . 
 predictor 
 . 
 Predictor 
 ] 
 ] 
 = 
 None 
 , 
 ) 
 

Initializes a Handler instance.

Parameters
Name
Description
artifacts_uri
str

Required. The value of the environment variable AIP_STORAGE_URI.

predictor
Type[Predictor]

Optional. The Predictor class this handler uses to initiate predictor instance if given.

handle

  handle 
 ( 
 request 
 : 
 starlette 
 . 
 requests 
 . 
 Request 
 ) 
 - 
> starlette 
 . 
 responses 
 . 
 Response 
 

Handles a prediction request.

Parameter
Name
Description
request
Request

The request sent to the application.