Apps Creation
Learn how to create a Clarifai application
As mentioned previously, an app on the Clarifai platform acts as a central repository for models, datasets, inputs, and other resources.
Create via the UI
To create an app, log in to your account and click the Create button at the upper-right section of the navigation bar.
And on the window that pops up, select the Start with a Blank App option to create a new application from scratch.
You can also select the Use an App Template option to use a template to create a new application.
Next, on the window that appears, provide the information required to create a new application.
-
App ID — This serves as a unique identifier for your application. It’s important to choose a unique and memorable ID as it will be used for URLs and redirections.
-
Short Description — Optionally, provide a brief description that outlines the purpose or features of your app.
-
Primary Input Type — Select the primary type of inputs that will be available in your app: either images/videos or texts/documents.
-
Advanced Settings — This collapsible field allows you to choose the base workflow for your app. Base workflows index your data and furnish your app with a default knowledge base. While a base workflow is automatically selected based on your primary input type, you can choose another one that best suits your specific use case.
Application names and other names in the Portal must follow a few rules:
- Names must be 1 to 32 letters or numbers in length, with hyphens or underscores as separators.
- Spaces, periods, etc., are not allowed as separators.
Lastly, click the Create App button at the upper-right corner of the page.
Copy (Duplicate) Apps
You can also create an app by cloning an existing application. Cloning an existing application can be a great way to start a new project, or branch an existing one. We’ve made cloning easy with a simple interface in the Portal.
After logging in to your Clarifai account, select the My Apps option on the navigation bar. Then, select the Apps / Templates option on the menu bar, and a list of your apps will populate that page.
Click the series of dots at the bottom-right corner of the app you want to copy its contents. Then, select the Duplicate option on the list that drops down.
The small window that pops up lets you select the destination user or organization, along with the destination app. You can copy the app as a new one or select an existing app. Additionally, you can specify particular resources you wish to duplicate.
Lastly, click the Confirm button, and the copied app will be automatically created for you.
Create via the API
For enterprise customers, it is possible to generate applications programmatically. Note that you need to use a Personal Access Token (PAT) to create an application.
Create App With Default Base Workflow
The base workflow acts as the default knowledge base for your app and provides the basic structure for indexing your data.
If you create an application without specifying the base workflow, a default one will be automatically created for you.
- Python SDK
- Node.js SDK
- cURL
from clarifai.client.user import User
client = User(user_id="user_id", pat="YOUR_PAT")
# You can create an app by providing the app id
app = client.create_app(app_id="test_app")
import { User } from "clarifai-nodejs";
const client = new User({
userId: process.env.CLARIFAI_USER_ID,
pat: process.env.CLARIFAI_PAT,
appId: "",
});
// You can create an app by providing the app id
const app = await client.createApp({
appId: "test_app",
});
console.log(app);
curl --location --request POST "https://api.clarifai.com/v2/users/YOUR_USER_ID_HERE/apps/" \
--header "Content-Type: application/json" \
--header "Authorization: Key YOUR_PAT_HERE" \
--data-raw '{
"apps": [
{
"id": "test-app"
}
]
}'
Example Output
2024-01-15 16:11:26 INFO clarifai.client.user: user.py:122
App created
code: SUCCESS
description: "Ok"
req_id: "1728082daee63fa593411dcb573e7e33"
Create App With Different Base Workflow
You can create an app with a different base workflow. You can choose from a range of available base workflows, including Empty, Universal, Language Understanding, and General.
This enables you to seamlessly integrate and customize the fundamental structure of your app, ensuring it aligns perfectly with your project requirements.
- Python SDK
from clarifai.client.user import User
client = User(user_id="user_id", pat="YOUR_PAT")
# You can set the base workflow as ["Empty","Universal","Language-Understanding","General"]
app = client.create_app(app_id="test_app_2", base_workflow="Universal")