Media Management
This section explains how to use the LandingLens SDK and CLI to manage your dataset. You will be able to
- Upload new media with label, split and metadata
- Set Metadata for existing images
#
SDK Usagefrom landinglens import LandingLens
# Instantiate the llens client - Optionally can provide API Key and Secretllens = LandingLens()
llens.metadata.upload(media_id=[123, 124], timestamp=12345)# project_id: 1190# metadata: {"timestamp": "12345"}# media_ids: [123, 124]
llens.media.ls()# (lists all media with metadata from a project)# { medias: [{'id': 4358352, 'mediaType': 'image', 'srcType': 'user', 'srcName': 'Michal', 'properties': {'width': 258, 'height': 176}, 'name': 'n01443537_501.JPEG', 'uploadTime': '2020-09-15T22:29:01.338Z', 'metadata': {'source': 'prod'}, 'media_status': 'raw'}, ...],# num_requested: 1000,# count: 300,# offset: 0,# limit: 1000 }
# paginate explicitlyllens.media.ls(offset=0, limit=100)
# this one will fetch allllens.media.ls(no_pagination=True)
# any metadata can be used to filter the media (server side filtering)llens.media.ls(no_pagination=True, source="prod")
# only single media upload and without metadatallens.media.upload("~/Documents/image.jpg")
# folder upload, will upload all the media in the folder recursivelyllens.media.upload("~/Doucments/image_folder")
#
CLI Usagellens metadata upload --media_id=123,124 --timestamp=12345
# project_id: 1190# metadata: {"timestamp": "12345"}# media_ids: [123, 124]
llens media ls# (lists media with metadata from a project)# { medias: [{'id': 4358352, 'mediaType': 'image', 'srcType': 'user', 'srcName': 'Michal', 'properties': {'width': 258, 'height': 176}, 'name': 'n01443537_501.JPEG', 'uploadTime': '2020-09-15T22:29:01.338Z', 'metadata': {'source': 'prod'}, 'media_status': 'raw'}, ...],# num_requested: 1000,# count: 300,# offset: 0,# limit: 1000 }
# paginate explicitlyllens media ls --offset 0 --limit 100
# this one will fetch allllens media ls --no-pagination
# any metadata can be used to filter the media (server side filtering)llens media ls --no-pagination --source prod
# only single media upload and without metadatallens media upload ~/Documents/image.jpg
# folder upload, will upload all the media in the folder recursivelyllens media upload ~/Doucments/image_folder