Skip to main content

TensorBay Python SDK

Pre-commit Unit Test Documentation Status Downloads Coverage Status GitHub Slack PyPI PyPI - Python Version


IMPORTANT: TensorBay system underwent a huge refactoring, which broke the downward compatibility of OpenAPI and SDK. As a result, the SDK under version v1.6.0 does not work anymore.
Please update tensorbay SDK to v1.6.0 or a higher version.


TensorBay Python SDK is a python library to access TensorBay and manage your datasets.
It provides:

  • A pythonic way to access your TensorBay resources by TensorBay OpenAPI.
  • An easy-to-use CLI tool gas (Graviti AI service) to communicate with TensorBay.
  • A consistent dataset format to read and write your datasets.

Installation

pip3 install tensorbay

Documentation

More information can be found on the documentation site

Usage

An AccessKey is needed to communicate with TensorBay. Please visit this page to get an AccessKey first.

Authorize a client object

from tensorbay import GAS
gas = GAS("<YOUR_ACCESSKEY>")

Create a Dataset

gas.create_dataset("<DATASET_NAME>")

List Dataset names

dataset_names = gas.list_dataset_names()

Upload images to the Dataset

from tensorbay.dataset import Data, Dataset

# Organize the local dataset by the "Dataset" class before uploading.
dataset = Dataset("<DATASET_NAME>")

# TensorBay uses "segment" to separate different parts in a dataset.
segment = dataset.create_segment("<SEGMENT_NAME>")

segment.append(Data("0000001.jpg"))
segment.append(Data("0000002.jpg"))

dataset_client = gas.upload_dataset(dataset, jobs=8)

# TensorBay provides dataset version control feature, commit the uploaded data before using it.
dataset_client.commit("Initial commit")

Read images from the Dataset

from PIL import Image

dataset = Dataset("<DATASET_NAME>", gas)
segment = dataset[0]

for data in segment:
    with data.open() as fp:
        image = Image.open(fp)
        width, height = image.size
        image.show()

Delete the Dataset

gas.delete_dataset("<DATASET_NAME>")

Metadata

Release files for tensorbay 1.24.2

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

Source distribution (sdist)

Source distribution for tensorbay 1.24.2
File Size Uploaded
tensorbay-1.24.2.tar.gz 254.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tensorbay 1.24.2
File Interpreter ABI Platform
tensorbay-1.24.2-py3-none-any.whl Python 3 none any Details

Total release size: 631.4 kB

Release files / tensorbay-1.24.2.tar.gz

Download URL tensorbay-1.24.2.tar.gz
Size 254.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d186890f6a796cfdadc9ff4a13bb3fd31f6b928dbf346f61d4e0530052109dcb
BLAKE2b-256 checksum
How to use checksums
65571891408f546f5434efb92df4b795569a28a2f52694a10c31b1784b68a965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / tensorbay-1.24.2-py3-none-any.whl

Download URL tensorbay-1.24.2-py3-none-any.whl
Size 376.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9db800234862a951e81e7609af11995bc9c5aee01cc754ecace9531a0b8a775
BLAKE2b-256 checksum
How to use checksums
7ccf03be15e1751422f846bb02cd4e58c198e6665fcbe4b3cd70bcf75b778b73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.24.2 This release

2 release files

1.24.1

2 release files

1.24.0

2 release files

1.20.0

2 release files

1.19.0

2 release files

1.18.1

2 release files

1.18.0

2 release files

1.16.1

2 release files

1.16.0

2 release files

1.14.0

2 release files

1.13.0

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.10.2

2 release files

1.10.1

2 release files

1.10.0

2 release files

1.9.0

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

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