Images
Manage the images in your DataGym.ai Datasets with our Python API
The Image objects in our Python API are not real images (in bytes) but hold the reference attributes (ID, name, etc.) from images in DataGym.ai. However, the Python API Client allows you to directly download these images from your DataGym.ai Projects.
Upload Images
1. Choose the Dataset you want to upload images to
2.1 Upload a local image to DataGym.ai
optionally you can manually set the image name
2.2 Upload from image urls
Download Images
Select an image from your Project/Dataset
1. Choose a Project (or Dataset)
2. Choose an image
We simple take the first image of our Dummy Project for this example
Download the image data
Download as Bytes
You can download and store the selected image as byte stream via the download_image_bytes
method of the API Client. The method requires the Image object you selected during the recent steps.
download_image_bytes
returns the image as bytes in Python
Use-Case: Do you want to inspect the image you downloaded in your application? Let's use some additional packages to visualize our newly downloaded image
Install Pillow - the Python Imaging Library - with pip to run this example
This little script will view the Image on your machine.
Download image as file
You can also directly download an image to your machine. Therefore, execute the download_image
method which requires the Image object you want to download and the destination on your machine.
Delete Images
To delete an image from your DataGym.ai Dataset use the delete_image
method of the Client class. The method only requires an Image Object.
delete_image
returns True
if the image was successfully deleted
Executing this method will permanently delete the Image from your DataGym.ai Dataset
The Image object
Image Attributes
The Image object in the Python API is modeled after DataGym's Images.
Last updated