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 hear 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 or click on an existing one. Doing either will take you to that application's specific page:
...and to access your app workflows, all you need to do is click on the little ">" symbol next to the bolded Workflows title at the bottom. By default you'll already have one called "General" which contains our General and General Embedding Models, and that one cannot be edited:
You can however create as many new application workflows as you'd like here via the Create Workflow button, each with up to 5 models in them. If you're adding a custom model to any of them, note that it will only use the version of the model at that point, and any future changes to the model will not be incorporated.
Here's an example of one with General, Food and NSFW:
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 BW dropdown menu you'll only see General, Food, NSFW, Moderation, Wedding and Travel as options, and these are indeed the only six 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!