Predict
Run inference on models deployed on the CX platform. You can run inference on models you uploaded yourself, or publicly available ones hosted by CX.
Command Line Interface
Run predictions directly from the commandline with the cx predict command.
cx predict arguments:
--appthe name of the deployed app--datathe payload that the model is expecting--is-publica boolean (defaultFalse). This will beTrueif you are accessing a publicly hosted model by CX, andFalseif your org is hosting it.--is-serverlessa boolean (defaultFalse). This will beTrueif the app was deployed as serverless.
cx predict --app starcoder --data '{"prompt": "def helloworld():"}' --is-public TruePython
To call the API using python, follow the examples in
cURL Request
Alternatively, you can run inference through a cURL request as well:
$ export CX_API_KEY=<your-api-key>
$ curl -X 'POST' \
'https://api.computex.co/api/v1/deployments/template-03db38d/infer' \
-H 'accept: application/json' \
-H 'Authorization: Bearer $CX_API_KEY' \
-H 'Content-Type: multipart/form-data' \
-F 'input_file=@<filename-to-upload>;type=<mime type>' \
-F 'params=[{"name":"<your-param-name>", "value":"<your-param-value>"}, {"name":"<your-param-name>", "value":"<your-param-value>"}]'Update the payload in -F to match your desired inference configuration.
Last updated