Skip to content

Instantly share code, notes, and snippets.

@arunreddy
Created January 5, 2022 20:31
Show Gist options
  • Save arunreddy/9910658871b4a17e2b0d84e77c58108a to your computer and use it in GitHub Desktop.
Save arunreddy/9910658871b4a17e2b0d84e77c58108a to your computer and use it in GitHub Desktop.
SuperbAI Image Annotation Upload
# create the client.
client = spb.sdk.Client(project_name='fitness_dataset')
DATASET = 'fitness_dataset_20210105'
img = 'img_002_f3a31eba219e2865.jpg'
try:
data_handler = next(client.get_data_page(page_idx=0, page_size=1, dataset=DATASET, data_key=img))
except StopIteration:
print('Data with this key does not exist')
else:
print(f'Successfully retrieved ({data_handler.get_dataset_name()}, {data_handler.get_key()})')
category_labels = {'properties': [{'name': 'activity', 'value': ['hiit']},
{'name': 'workout', 'value': []},
{'name': 'action', 'value': 'squat'}]}
data_handler.set_category_labels(category_labels)
try:
data_handler = next(client.get_data_page(page_idx=0, page_size=1, dataset=DATASET, data_key=img))
except StopIteration:
print('Data with this key does not exist')
else:
print(f'Successfully retrieved ({data_handler.get_dataset_name()}, {data_handler.get_key()})')
print(data_handler.get_category_labels())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment