Workflows
Last updated
Last updated
Workflows are a graph of computation that encompass one or more Clarifai or Custom model(s). Every workflow is attached to one of your applications. Under each workflow, you will see a list of the Clarifai Models and all custom models in that application when selecting models to add to your workflow. With Workflow Predict, you will be able to reduce the latency and in turn make your product more efficient.
Note: this won't have any impact on the price you are charged per call. You will still be charged for the same operation if it were separate calls to the API.
To set up a workflow, you will need to head over to the Applications page through your account. From there, you will need to select which application you want to create the workflow under.
Then under that application, you will see a section labeled "App Workflows" and a button to "Create Workflow".
After that, the page will reveal a new workflow form to fill out. Fill out the Workflow ID field, this will be used to make the API call, so make sure to give it something URL friendly! Included there, you will also a list that consists of a model field and a version associated with it. For Clarifai Models, you will be mandated to use the latest version. For your custom models, you will be able to select the version of your model</a>. To add another model, you will just click underneath your latest addition on the "Add Model". The max limit of models associated with any given workflow is 5 models. If you would like to remove a model, there is a large X that will allow you to remove a model. Once you have finished adding everything, press the "Save Workflow" button and that will save the state of your workflow. Now you are ready to predict using your brand new workflow. You can edit a given workflow at any time, in case you don't like it.
The Workflow Predict API allows you to predict using 1 or more model(s), regardless of them being Clarifai or custom, within a single API call! The max number of inputs processed at once with any given workflow is 32.
Now that you have that all set up, you will be able to predict under a workflow using the POST /v2/workflows/{workflow_id}/results
endpoint. Your {workflow-id}
currently is whatever you set as your ID. Then as far as your request body, nothing has changed with how you would normally do a predict. In the response body, you will see a results
object and each object will be the response from the models in the same ordering from the workflow you set up.
You can also use the Explorer in Clarifai Portal to see the results of your workflow's predictions on a given input.