Greetings Clarifai-ers! If you're thinking about using our software or have already had the pleasure of dabbling with it, you've probably encountered this "Workflows" term in some form or another. I'm here to clear the air for you so that all of it makes sense and that you get the most use out of them!
App Workflows vs. Base Workflows
The first thing that we need to clarify (no pun intended...ok fine it was) is the difference between these two workflows types, as they serve very different functions.
- An application workflow is essentially used when you want to call up to 5 models at once (including custom models) to retrieve all of the output in one, singular response, either via the User Interface or our API. Pretty nifty right? If you're using the API, this will require only one line of code versus X lines for the X models that you're using.
- A base workflow, on the other hand, is a base model that your application will use to optimize any of your custom models and visual search results via all of the base model's pre-existing knowledge. Thus, you will only need to worry about this if you are doing Custom Training or Visual Search.
Let's delve into these two items a little bit closer.
Application Workflows: Explained Further
An application workflow can be used to call up to 5 models at once (public + custom), and as the name suggests, it is always tied to a particular application in your account.
Setting it up
From your applications page here, you'll see something like the following:
Great! Now you can either create a new application (top right) or click on an existing one. Doing either will take you to that application's specific page:
...and to access your workflows, all you need to do is go to the App Workflows section in the above screenshot. By default you won't have any at first so you'll need to click on the "Create New Workflow" button, which will lead you here:
Here you can add up to 5 models to call at once, and you can have as many of these (workflows, that is) as you'd like. Note that if you're adding a custom model to any of them, you can only use a version of the model up until that point, and any future changes to the model will not be incorporated.
Here's an example of one with General, Food and my custom model:
Predicting on them
Now that you've created a workflow you'll want to use it of course! You can do this via our User Interface or our API if you prefer to do it the programmatic way, either of which are pretty simple to master.
• In our User Interface, all you have to do is click on one of your images and the workflow results will be there!
• In the API, you can retrieve your workflow results with one of the following languages. Just make sure to replace "workflow-id" with your own:
// Do something with response
// There was an error
from clarifai.rest import ClarifaiApp
from clarifai.rest import Workflow
from clarifai.rest import Image as ClImage
app = ClarifaiApp(api_key='YOUR_API_KEY')
workflow = Workflow(app.api, workflow_id="your-workflow-id")
image = ClImage(url='https://samples.clarifai.com/metro-north.jpg')
public class YourClassName
public static async Task Main()
var client = new ClarifaiClient("YOUR_API_KEY");
curl -X POST \
-H 'authorization: Key YOUR_API_KEY' \
-H 'content-type: application/json' \
And voila! That's about it for application workflows.
Base Workflows: Explained Further
Unlike Application Workflows, there isn't a whole lot that you need to know or do for your base workflow setup, but let's go through them briefly.
When you first create an application you will be presented with the following screen, with the Base Workflow menu at the bottom:
You'll notice that when you click the dropdown menu you'll only see General, Food, NSFW, Moderation, Wedding, Travel and Face as options, and these are indeed the only seven available for this functionality.
A few things about this:
- If you are not creating any custom models (i.e. you are only using our 17 public ones) or doing visual searches within your application then you won't need to worry about what you choose here
- If you are using a custom model or visual search, then you will want to pick one of the six options that most closely associates to your model and/or images. For example, if you're training a model on food, then you'll want to pick the food one. Interior rooms of a house - pick the travel one. And if you're ever unsure of what to choose, it's always a safe bet to pick the General option as it contains over 11,000 broad concepts (including food and rooms of a house!).
- Your base model will not alter the concepts that you create in your custom model. It only exists to make your model more optimal by combining the base model's knowledge with yours.
- Once you select a Base Model, it cannot be changed. Ever. So make sure you know which one you'll want!
And that's pretty much it!
Go out there and make some great workflows Clari-fam!