Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,17 @@ task_id = client.create_robotics_task(
)
```

#### Import Contents

Import contents zip file

```python
history = client.import_robotics_contents_file(
project="YOUR_PROJECT_SLUG",
file_path="ZIP_FILE_PATH",
)
```

### Common

APIs for update and delete and count are same over all tasks.
Expand Down
26 changes: 26 additions & 0 deletions fastlabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2100,6 +2100,32 @@ def get_appendix_data(

return self.api.get_request(endpoint, params=params)

def import_robotics_contents_file(
self,
project: str,
file_path: str,
) -> list:
"""
Import robotics contents file zip.
project is slug of your project (Required).
file_path is a path to data. Supported extensions are zip (Required).
"""

if not utils.is_robotics_contents_supported_ext(file_path):
raise FastLabelInvalidException("Supported extensions are zip.", 422)

endpoint = "contents/imports/robotics-contents/batch"
payload = {"project": project}
signed_url = self.__get_signed_path(
project=project,
file_name=os.path.basename(file_path),
file_type="application/zip",
)
self.api.upload_zipfile(url=signed_url["url"], file_path=file_path)
payload["fileKey"] = signed_url["name"]

return self.api.post_request(endpoint, payload=payload)

# Task Update

def update_task(
Expand Down
4 changes: 4 additions & 0 deletions fastlabel/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def is_appendix_supported_ext(file_path: str) -> bool:
return file_path.lower().endswith((".zip"))


def is_robotics_contents_supported_ext(file_path: str) -> bool:
return file_path.lower().endswith((".zip"))


def is_pcd_supported_ext(file_path: str) -> bool:
# .ply is not yet supported. To support it, modification of the API
# needs to be considered as well.
Expand Down
Loading