Skip to main content

ClarifaiPySpark

Introduction

This readme provides overview of the Software Development Kit (SDK) under development for integrating Clarifai with Databricks. The primary use case for this SDK is to facilitate the interaction between Databricks and Clarifai for tasks related to uploading client datasets, annotating data, and exporting and storing annotations in Spark DataFrames or Delta tables.

Screenshot 2023-11-17 at 5 21 04 PM

The initial use case for this SDK revolves around three main objectives:

Uploading Client Datasets into Clarifai App:

The SDK should enable the seamless upload of datasets into the Clarifai application, simplifying the process of data transfer from Databricks to Clarifai.

Annotate the Data:

It should provide features for data annotation, making it easier for users to add labels and metadata to their datasets within the Clarifai platform.

Export Annotations to Spark DataFrames/Delta Tables:

The SDK should offer functionality to export annotations and store them in Spark DataFrames or Delta tables, facilitating further data analysis within Databricks.

Requirements:

  • Databricks : Runtime 13.3 or later
  • Clarifai : pip install clarifai
  • Create your Clarifai account
  • Follow the instructions to get your own Clarifai PAT
  • Protocol Buffers : version 4.24.2 pip install protobuf==4.24.2

Setup:

Install the package and initialize the clarifaipyspark class to begin.

pip install clarifai-pyspark

Getting Started:

from clarifaipyspark.client import ClarifaiPySpark

Create a Clarifai-PySpark client object to connect to your app on Clarifai. You can also choose the dataset or create one in your clarifai app to upload the data.

claps_obj = ClarifaiPySpark(user_id=USER_ID, app_id=APP_ID, pat=CLARIFAI_PAT)
dataset_obj = claps_obj.dataset(dataset_id=DATASET_ID)

Examples:

Checkout these notebooks for various operations you can perform using clarifai-pyspark SDK.

Notebook Description GitHub
ClarifaiPyspark_Example_NB An extensive notebook which walks through the journey from data ingestion to exporting annotations GitHub
export_to_df_demo Explains the process of exporting annotations from clarifai app and storing it as dataframe in databricks GitHub

If you want to enhance your AI journey with workflows and leveraging custom models (programmatically) our Clarifai SDK might be good place to start with. Please refer below resources for further references.

Metadata

Release files for clarifai-pyspark 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clarifai-pyspark 0.0.4
File Size Uploaded
clarifai-pyspark-0.0.4.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clarifai-pyspark 0.0.4
File Interpreter ABI Platform
clarifai_pyspark-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 24.3 kB

Release files / clarifai-pyspark-0.0.4.tar.gz

Download URL clarifai-pyspark-0.0.4.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ec186f0cff489969a92afa9ecd5cf1f43c6fabffbb3b91eb120bb7a7f7439787
BLAKE2b-256 checksum
How to use checksums
9c7c8b4edee4ad3c12bdef3308c59578c9d8615b80ae1adc31cb45f11e5f435b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / clarifai_pyspark-0.0.4-py3-none-any.whl

Download URL clarifai_pyspark-0.0.4-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39abace7d009b4dcac5ab5e90897d9106b269a814e09fb84fc0b76fa1e36bbb8
BLAKE2b-256 checksum
How to use checksums
345ddd1b22256368bf22511df740347f9f16237641f2e4642b9fc00abb800b56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page