Skip to content

Examples for Clarifai Python SDK and Integrations. Give the repo a star ⭐

License

Notifications You must be signed in to change notification settings

Clarifai/examples

Repository files navigation

image

Clarifai Python SDK and Integrations Examples

This is a collection of examples for the clarifai-python SDK and Integrations done with Clarifai SDK. Use these examples to learn Clarifai and build your own robust and scalable AI applications.

Experience the power of Clarifai in building Computer Vision , Natual Language processsing , Generative AI applications.

Website | Schedule Demo | Signup for a Free Account | API Docs | Clarifai Community | Python SDK Docs | Examples | Colab Notebooks | Discord

Setup

  • Sign up for a free account at clarifai and set your PAT key.

  • You can generate PAT key in the Personal settings -> Security section

  • Install the Clarifai python sdk.

  • Export your PAT as an environment variable.

    export CLARIFAI_PAT={your personal access token}
  • Explore and run the examples in this repo.

Usage

The examples are organized into several folders based on their category. A quick example below,

from clarifai.client.dataset import Dataset
dataset = Dataset(user_id="user_id", app_id="app_id", dataset_id="dataset_id")
dataset.upload_dataset(task="text_clf", split="train", module_dir="path_to_imdb_reviews_module")

SDK Notebooks

Function Notebook Description Open in Colab
Basics Basics Basic Functionalities (create, list, patch, delete) of SDK App, Dataset, Input & Model Classes Open in Colab
Compute Orchestration CRUD Operations Basic Functionalities (create, list, get, delete) of Compute Orchestration Classes - ComputeCluster, Nodepool, Deployment Open in Colab
Concepts Concept Management Basic Functionalities (add, search, delete) of Concept Relations Open in Colab
Datasets Basics Basic Functionalities of Dataset & Input Class in SDK Open in Colab
Input Upload Upload Functionalities of SDK with different kinds of data (image, text, audio, video ) and annotations (classes, bbox, etc) using Input Class Open in Colab
Dataset Upload Upload Functionalities of SDK with different of dataset annotation formats (Clarifai, Cifar10, VOC, etc.) using Dataset Class Open in Colab
Dataset Export Export Functionalities of SDK to different of dataset annotation formats (Clarifai, Cifar10, VOC, etc.) using Dataset Class Open in Colab
Workflows Create Workflow Different kinds of Workflow Creation examples using SDK Open in Colab
Patch Workflow Modifying a workflow with patch operations using SDK Workflow Class Open in Colab
Export Workflow Exporting Workflow config and create a modified workflow using SDK Workflow Class Open in Colab
Model Predict Model Predict Prediction Functionalities of SDK Model Class for different type of input data Open in Colab
Model Training Image Classification Training Model Train demo for Visual-Classifier model type with MMClassification_EfficientNet Template Open in Colab
Text Classification Training Model Train demo for Text-Classifier model type with HF_GPTNeo_125m_lora template Open in Colab
Image Detection Training Model Train demo for Visual-Detector model type with MMDetection template Open in Colab
Image Segmentation Training Model Train demo for Visual-Segmenter model type with MMDetection template Open in Colab
Transfer Learn Training Model Train demo for Embedded-Classifier model type using Transfer-Learning Open in Colab
Model Evaluation Embedding Classifier Model Eval demo for Embedded-Classifier model type using SDK Open in Colab
Text Classifier Model Eval demo for Text-Classifier model type using SDK Open in Colab
Visual Classifier Model Eval demo for Visual-Classifier model type using SDK Open in Colab
Visual Detector Model Eval demo for Visual-Detector model type using SDK Open in Colab
Search Vector Search Introductory guide to setting up a Cross-Modal Search system using SDK Open in Colab
RAG RAG RAG setup and chat with the RAG interface. Open in Colab

Integrations Notebooks

Integration Function Notebook Open in Colab
Langchain Chains Prompt Templates and Chains Open in Colab
Retrieval QA Chain Open in Colab
Router Chain Open in Colab
PostgreSQL LLM Open in Colab
Agents Conversational Agent Open in Colab
ReAct Docstore Agent Open in Colab
Unstructured.io Github Data Ingestion Open in Colab
S3 Data Ingestion Open in Colab
DropBox Data Ingestion Open in Colab

Data Utils Notebooks

Data Util Function Notebook Open in Colab
Image Image Annotation annotation loader Open in Colab
Multimodal Data Ingestion Ready to Use Pipelines Open in Colab
Data Ingestion Multimodal Ingestion Open in Colab

Model upload examples

There is an exciting new model upload experience now in private preview. We'd love for you to try it out and give us feedback! If you're interested, please sign up for private preview here.

Note

Although these scripts are run on your local machine, they'll communicate with Clarifai and run in our cloud on demand.

Examples provide a guided tour through Clarifai's concepts and capabilities. contains uncategorized, miscellaneous examples.