Skip to main content

Clarifai logo

Clarifai Python Data Utils

Discord codecov

This is a collection of utilities for handling various types of multimedia data. Enhance your experience by seamlessly integrating these utilities with the Clarifai Python SDK. This powerful combination empowers you to address both visual and textual use cases effortlessly through the capabilities of Artificial Intelligence. Unlock new possibilities and elevate your projects with the synergy of versatile data utilities and the robust features offered by the Clarifai Python SDK. Explore the fusion of these tools to amplify the intelligence in your applications! 🌐🚀

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


Table Of Contents

Installation

Install from PyPi:

pip install clarifai-datautils

Install from Source:

git clone https://github.com/Clarifai/clarifai-python-datautils
cd clarifai-python-datautils
python3 -m venv env
source env/bin/activate
pip3 install -r requirements.txt

Getting started

Quick intro to Image Annotation Conversion feature

from clarifai_datautils import ImageAnnotations

annotated_dataset = ImageAnnotations.import_from(path= 'folder_path', format= 'annotation_format')

Features

Image Utils

  • Annotation Loader

    • Load various annotated image datasets and export to clarifai Platform
    • Convert from one annotation format to other supported annotation formats

Data Ingestion Pipeline

  • Easy to use pipelines to load data from files and ingest into clarifai platfrom.
  • Load text files(pdf, doc, etc..) , transform, chunk and upload to the Clarifai Platform

Usage

Image Annotation Loader

from clarifai_datautils import ImageAnnotations
#import from folder
coco_dataset = ImageAnnotations.import_from(path='folder_path',format= 'coco_detection')

#Using clarifai SDK to upload to Clarifai Platform
#export CLARIFAI_PAT={your personal access token}  # set PAT as env variable
from clarifai.client.dataset import Dataset
dataset = Dataset(user_id="user_id", app_id="app_id", dataset_id="dataset_id")
dataset.upload_dataset(dataloader=coco_dataset.dataloader)

#info about loaded dataset
coco_dataset.get_info()


#exporting to other formats
coco_dataset.export_to('voc_detection')

Data Ingestion Pipelines

Setup

To use Data Ingestion Pipeline, please run

pip install -r requirements-dev.txt
from clarifai_datautils.text import Pipeline, PDFPartition
from clarifai_datautils.text.pipeline.cleaners import Clean_extra_whitespace

# Define the pipeline
pipeline = Pipeline(
    name='pipeline-1',
    transformations=[
        PDFPartition(chunking_strategy = "by_title",max_characters = 1024),
        Clean_extra_whitespace()
    ]
)


# Using SDK to upload
from clarifai.client import Dataset
dataset = Dataset(dataset_url)
dataset.upload_dataset(pipeline.run(files = file_path, loader = True))

More Examples

See many more code examples in this repo.

Metadata

Release files for clarifai-datautils 0.0.7

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-datautils 0.0.7
File Size Uploaded
clarifai_datautils-0.0.7.tar.gz 23.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clarifai-datautils 0.0.7
File Interpreter ABI Platform
clarifai_datautils-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 55.0 kB

Release files / clarifai_datautils-0.0.7.tar.gz

Download URL clarifai_datautils-0.0.7.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4fc7c48f2b245a1619d1d1ef290128f23cb9961eb2d56b6fcdea2a7adff789c9
BLAKE2b-256 checksum
How to use checksums
80a5fcdc9bd838a1e8f23543ac849eb023af7dc601787e55c4cc78965d76f128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.21

Release files / clarifai_datautils-0.0.7-py3-none-any.whl

Download URL clarifai_datautils-0.0.7-py3-none-any.whl
Size 31.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
733ebc999f59a21f5fbd415eb47f07affc1aefbec81250e8ea80ae11e052f819
BLAKE2b-256 checksum
How to use checksums
b9a4fce5c26283773508f1e90ab4b8e78bb6cf2902e729ed4c2280e4266ec6c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.21

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

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