Skip to content

Commit 158377d

Browse files
authored
Merge pull request #162 from fastlabel/feature/integrated-image-classification-create-sdk
[sdk][画像 - 分類]ストレージ連携によるタスク作成api
2 parents f906ca7 + 2c629fa commit 158377d

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,19 @@ task_id = client.create_image_classification_task(
463463

464464
- You can upload up to a size of 20 MB.
465465

466+
#### Create Integrated Image Classification Task
467+
468+
Create a new classification task by integrated image.
469+
(Project storage setting should be configured in advance.)
470+
471+
```python
472+
task_id = client.create_integrated_image_classification_task(
473+
project="YOUR_PROJECT_SLUG",
474+
file_path="<integrated-storage-dir>/sample.jpg",
475+
storage_type="gcp",
476+
)
477+
```
478+
466479
#### Find Task
467480

468481
Find a single task.

fastlabel/__init__.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,62 @@ def create_image_classification_task(
10541054

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

1057+
def create_integrated_image_classification_task(
1058+
self,
1059+
project: str,
1060+
file_path: str,
1061+
storage_type: str,
1062+
status: str = None,
1063+
external_status: str = None,
1064+
priority: Priority = None,
1065+
attributes: list = None,
1066+
tags: list = None,
1067+
**kwargs,
1068+
) -> str:
1069+
"""
1070+
Create a single integrated image classification task.
1071+
1072+
project is slug of your project (Required).
1073+
storage type is the type of storage where your file resides (Required). e.g.) gcp
1074+
file_path is a path to data in your setting storage bucket. Supported extensions are png, jpg, jpeg (Required).
1075+
status can be 'registered', 'completed', 'skipped', 'reviewed', 'sent_back',
1076+
'approved', 'declined' (Optional).
1077+
external_status can be 'registered', 'completed', 'skipped', 'reviewed',
1078+
priority is the priority of the task (default: none) (Optional).
1079+
Set one of the numbers corresponding to:
1080+
none = 0,
1081+
low = 10,
1082+
medium = 20,
1083+
high = 30,
1084+
'sent_back', 'approved', 'declined', 'customer_declined' (Optional).
1085+
attributes is a list of attribute to be set in advance (Optional).
1086+
tags is a list of tag to be set in advance (Optional).
1087+
assignee is slug of assigned user (Optional).
1088+
reviewer is slug of review user (Optional).
1089+
approver is slug of approve user (Optional).
1090+
external_assignee is slug of external assigned user (Optional).
1091+
external_reviewer is slug of external review user (Optional).
1092+
external_approver is slug of external approve user (Optional).
1093+
"""
1094+
endpoint = "tasks/integrated-image/classification"
1095+
payload = {"project": project, "filePath": file_path, "storageType": storage_type}
1096+
attributes = attributes or []
1097+
tags = tags or []
1098+
if status:
1099+
payload["status"] = status
1100+
if external_status:
1101+
payload["externalStatus"] = external_status
1102+
if priority is not None:
1103+
payload["priority"] = priority
1104+
if attributes:
1105+
payload["attributes"] = attributes
1106+
if tags:
1107+
payload["tags"] = tags
1108+
1109+
self.__fill_assign_users(payload, **kwargs)
1110+
1111+
return self.api.post_request(endpoint, payload=payload)
1112+
10571113
def create_sequential_image_task(
10581114
self,
10591115
project: str,

0 commit comments

Comments
 (0)