APIs – your technical interface to Capice capice.ai
All of the Capice platform is accessible via the user interface at www.capice.ai and is also ready for you to use in your own software development project via the API interface. Capice.ai and the Capice iPhone app were built using these APIs. They work. That means you can build machine mearning in to your own application with very little development effort ! Good stuff…
Typically you will create your machine learning models in the user interface of the web application. It is very easy to do and takes minutes. Once you have the data in hand that you want to use as training.
If you choose to make use of it, the API access is via REST services and makes use of JSON payload formats as well as multi-part form data (for file transfers) for input. All returned values are in JSON formats. For example: {“ID” : “123”, “Name”: “abc” }
The APIs you will most frequently use are Sign In, Sign Out, Run Model (for image, line of text, text file, audio, linear regression on a single item, linear regression on a file), Run chain on an image, Get a model list or retrieve messages in your mailbox
Sign In
To use the APIs, first sign in to capice.ai using the credentials you created when you registered.
Request
URI: https://authentication-prod.capice.ai/v1/users/sign-in
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
password The password used when you registered |
String | Required |
Request Example
Response
On success JSON is returned with key value of status set to OK. A return value set to Error indicates an error authenticating and the JSON error value contains the error reason. 3 failed attempts in a row locks the account for 1 hour.
Sign Out
When you are done using the API interface Sign Out. You will automatically be signed out if idle for 60 minutes.
Request
URI: https://authentication-prod.capice.ai/v1/users/sign-out
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
Request Example
Response
On success JSON is returned with value of status set to OK. A return value set to Error indicates an error signing out and the JSON error value contains the error reason.
Classify an image
Use file types BMP, JPEG or GIF. But no animated GIFs. Use a published model or one you have created. It will classify an image file and return a JSON result. Since this is processing a file, use input type of multi part form data – not JSON.
Request
URI: https://run-model-prod.capice.ai/v1/models/image/file
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
Multi-part form data: String | Required |
ID The trained image model ID – one of yours or a community model |
Multi-part form data: String | Required |
filename The contents of the image file to classify – just one image can be specified |
Multi-part form data: Integer data bytes | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the classification result is JSON data element. The result is three part. “A return value set to Error indicates an error running the model and the JSON error value contains the error reason. The data results are a confidence value and three result values starting with the most likely.
The count value indicates how many images were processed. In the event classification was on a video stream with multiple frames (images) this will be the number of frames processed.
Classify a video stream
Use file types MP4 or AVI. Use a published model or one you have created. It will classify a video stream – frame by frame, and return a JSON result. Since this is processing a file, use input type of multi part form data – not JSON.
Request
URI: https://run-model-prod.capice.ai/v1/models/video/file
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
Multi-part form data: String | Required |
ID The trained image model ID – one of yours or a community model |
Multi-part form data: String | Required |
filename The contents of the video to classify |
Multi-part form data: Integer data bytes | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the classification result is JSON data element. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. The data results are a set of classifications – frame by frame.
The count value indicates how many images were processed. For video classification with multiple frames (images) this will be the number of frames in the video.
Classify a line or paragraph of text
The text input can be as long as want and will result in a single classification. Run this on a published model or one you have created. It will classify text that you provide and return the result.
Request
URI: https://run-model-prod.capice.ai/v1/models/text/one/
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained text model ID – one of yours or a community model |
String | Required |
Text The text to classify |
String | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the classification result is JSON data element. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. count for a single classification will always be 1.
Classify an entire file of text
Classify a plain text file – row by row. The response will be a classification per row. This enables you to run many classifications at once. Run this on a published model or one you have created. It will classify text that you provide and return the result.
Request
URI: https://run-model-prod.capice.ai/v1/models/text/one
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained text model ID – one of yours or a community model |
String | Required |
File The contents of the file to classify. Each row seperated by a newline character. |
Multi-part form data | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the classification result is JSON data element. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. In the file to run, use the exact same format as the training file — except no ground truth column. count value will be the number of rows in the inference file and the size of the returned array of inferences.
Numeric prediction on one item
Numeric prediction predicts a numeric value as opposed to classification (such as what will be the sales price of my home) from a numeric set of feature data. Run this on a published model or one you have created. It will perform numeric prediction based on the features in the training model.
Request
URI: https://run-model-prod.capice.ai/v1/models/linear/one
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained numeric prediction model ID – one of yours or a community model |
String | Required |
Text The numeric prediction values. A single line of comma separated values. These are the features as in the training file |
String | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the numeric prediction result is JSON data. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. count for a single classification will always be 1..
Numeric prediction on a file
Classify an entire CSV file of numeric prediction data – row by row. Each row in the CSV file is a single set of features to use for inference. Use this to run a large batch of numeric predictions. This predicts a CSV file that you provide and returns CSV file as result. Since this is processing a file, use input type of multi part form data – not JSON.
Request
URI: https://run-model-prod.capice.ai/v1/models/linear/file
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained numeric prediction model ID – one of yours or a community model |
String | Required |
File The numeric prediction values. Multiple rows with comma separated values. Each row seperated by newline character. Each row has the same features as in training. |
Multi-part form data | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the classification result is JSON data element. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. Use same format for the inference data as was used for the training file except no ground truth column. count value will be the number of rows in the inference file and the size of the returned array of inferences.
Numeric classification on one item
Takes numeric feature data input and classifies it. Run this on a published model or one you have created. It will perform numeric classification based on the features in the training model.
Request
URI: https://run-model-prod.capice.ai/v1/models/numeric-classification/one
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained numeric classifictaion model ID – one of yours or a community model |
String | Required |
Text The numeric classification inference values. A single line of comma separated values. These are the same features as in the training file |
String | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the numeric classification result is JSON data. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. count for a single classification will always be 1. probability is an indicator of how sure the result is.
Numeric classification on a file
Classify an entire CSV file of feature data – row by row. Each row in the CSV file will receive a single set of values to predict. Use this to run a large batch of numeric classifications. This classifies a CSV file that you provide and returns CSV file as result. Since this is processing a file, use input type of multi part form data – not JSON.
Request
URI: https://run-model-prod.capice.ai/v1/models/numeric-classification/file
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained numeric classification model ID – one of yours or a community model |
String | Required |
File The numeric classification inference values. Multiple rows with comma seperated values. Each line sperated by a newline character. Every row has the same features as in the training file |
Multi-part form data | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the classification result is JSON data element. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. In the file to run, use the exact same format as the training file — except no ground truth. That means each row starts with a comma. We are going to fix this in our next release to eliminate need for the leading comma. Use same format for the inference data as was used for the training file except no ground truth column. probability” is an indicator of how sure the result is. source is a row by row representation of the input data.
Numeric binary classification on one item
Numeric binary classification inference is returned as is ‘in’ or ‘out’ of the tarined data set. Run this on a published model or one you have created. It will perform numeric binary classification based on the features in the training model.
Request
URI: https://run-model-prod.capice.ai/v1/models/binary/one
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained binary classification model ID – one of yours or a community model |
String | Required |
Text The binary classification inference values. A single line of comma separated values. These are the same features as in the training file |
String | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the binary classification result is JSON data. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. countfor a single binary classification will always be 1.
Numeric binary classification on a file
Classify an entire CSV file of binary classifications – row by row. Binary Classification returns the reult of “in the data set” or “outside the data set” but does this via a high dimensional wrapper around all the training data. So it is a not a simple algorithm of ‘less than” or “greater than”. Each row in the CSV file is a set of values to predict. Use this to run a large batch of binary classifications. This classifies a CSV file that you provide and returns CSV file as result. Since this is processing a file, use input type of multi part form data – not JSON. Use same format for the inference data as was used for the training file except no ground truth column.
Request
URI: https://run-model-prod.capice.ai/v1/models/binary/file
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained binary classification model ID – one of yours or a community model |
String | Required |
File The binary classification inference values. A single line of comma separated values. Each rowis seperated by a newline character. Every rows has the same features as in the training file. |
Multi-part form data | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the classification result is JSON data element. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. count value will be the number of rows in the inference file and the size of the returned array of inferences.
Classify audio
Use only file type of WAV format. Audio stream inference can be long, or an single, individual audio clip of less than 10 seconds. Run this on a published model or one you have created. It will perform numeric binary classification based on the features in the training model.
Request
URI: https://run-model-prod.capice.ai/v1/models/audio/file
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained audio model ID – one of yours or a community model |
String | Required |
audioStreamMode How to process the audio file. Omit the parameter and the file is assumed to be less than ten seconds and require one inference. 10 will take a much larger file and will process in 10 second chunks returning the result for each audio segment. If silence, the system will locate the audio in between silence, and return classifications. silence also supports large audio files. |
String | Optional |
Text The audio file data to process |
String | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the audio classification result is JSON data. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. For audio streams that do not use the audioStreamMode parameter, the audio is parsed to locate the complete list of sounds and the timestamp of each sound thta was classified is also returned.
Chain model inference on an image
Use types BMP, JPEG or GIF. But no animated GIFs. Use a published chain or one you have created. It will classify an image file through the chain and return a JSON result. Since this is processing a file, use input type of multi part form data – not JSON.
Request
URI: https://run-chain-prod.capice.ai/run-chain-file
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
ID The trained text model ID – one of yours or a community model |
String | Required |
File The contents of the image file to classify |
Multi-part form data | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the classification result is JSON data element. A return value set to Error indicates an error running the model and the JSON error value contains the error reason. The data results do not show a confidence value since chains are a series of model files being run where result1 feeds the next model file regardless of confidence.
Get list of models
Get a list of models – published or private
Request
URI: https://upload-list-prod.capice.ai/v1/model-list
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
Action The type of list to be returned: AllMySuccesful, AllMyUploads, AllPublished |
String | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the classification result is JSON data array of values. A return value set to Error indicates an error running the model and the JSON error value contains the error reason.
Get mailbox messages
Get a list of your mailbox messages
Request
URI: https://mailbox-prod.capice.ai/GetList
JSON Key | Type | Required |
---|---|---|
email The email used when you registered |
String | Required |
Request Example
Response
On success JSON is returned with value of status set to OK and the mailbox messages result is JSON data array of values. A return value set to Error indicates an error running the model and the JSON error value contains the error reason.