Skip to content

Commit ac3dcca

Browse files
committed
add import appendix
1 parent b8f1bb9 commit ac3dcca

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

fastlabel/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,32 @@ def create_sequential_pcd_task(
19741974

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

1977+
def import_appendix_file(
1978+
self,
1979+
project: str,
1980+
file_path: str,
1981+
) -> list:
1982+
"""
1983+
Import calibration file zip.
1984+
project is slug of your project (Required).
1985+
file_path is a path to data. Supported extensions are zip (Required).
1986+
"""
1987+
1988+
if not utils.is_appendix_supported_ext(file_path):
1989+
raise FastLabelInvalidException("Supported extensions are zip.", 422)
1990+
1991+
endpoint = "contents/imports/appendix/batch"
1992+
payload = {"project": project}
1993+
signed_url = self.__get_signed_path(
1994+
project=project,
1995+
file_name=os.path.basename(file_path),
1996+
file_type="application/zip",
1997+
)
1998+
self.api.upload_zipfile(url=signed_url["url"], file_path=file_path)
1999+
payload["fileKey"] = signed_url["name"]
2000+
2001+
return self.api.post_request(endpoint, payload=payload)
2002+
19772003
# Task Update
19782004

19792005
def update_task(

fastlabel/utils/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def is_dicom_supported_ext(file_path: str) -> bool:
4242
return file_path.lower().endswith((".zip"))
4343

4444

45+
def is_appendix_supported_ext(file_path: str) -> bool:
46+
return file_path.lower().endswith((".zip"))
47+
48+
4549
def is_pcd_supported_ext(file_path: str) -> bool:
4650
# .ply is not yet supported. To support it, modification of the API
4751
# needs to be considered as well.

0 commit comments

Comments
 (0)