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
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,34 @@ while True:

> Please wait a second before sending another requests!

#### Update Tasks

Update a signle task.

```python
task_id = client.update_image_task(
task_id="YOUR_TASK_ID",
status="approved",
assignee="USER_SLUG",
tags=["tag1", "tag2"],
annotations=[
{
"type": "bbox",
"value": "cat"
"attributes": [
{ "key": "kind", "value": "Scottish field" }
],
"points": [
100, # top-left x
100, # top-left y
200, # bottom-right x
200 # bottom-right y
]
}
],
)
```

#### Response

Example of a single image task object
Expand Down Expand Up @@ -678,13 +706,14 @@ APIs for update and delete are same over all tasks.

#### Update Task

Update a single task status and tags.
Update a single task status, tags and assignee.

```python
task_id = client.update_task(
task_id="YOUR_TASK_ID",
status="approved",
tags=["tag1", "tag2"]
tags=["tag1", "tag2"],
assignee="USER_SLUG"
)
```

Expand Down
42 changes: 42 additions & 0 deletions fastlabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,48 @@ def update_task(

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

def update_image_task(
self,
task_id: str,
status: str = None,
external_status: str = None,
tags: list = [],
annotations: list[dict] = [],
**kwargs,
) -> str:
"""
Update a single image task.

task_id is an id of the task. (Required)
status can be 'registered', 'completed', 'skipped', 'reviewed', 'sent_back', 'approved', 'declined'. (Optional)
external_status can be 'registered', 'completed', 'skipped', 'reviewed', 'sent_back', 'approved', 'declined', 'customer_declined'. (Optional)
tags is a list of tag to be set. (Optional)
annotations is a list of annotation to be set. (Optional)
assignee is slug of assigned user. (Optional)
reviewer is slug of review user. (Optional)
approver is slug of approve user. (Optional)
external_assignee is slug of external assigned user. (Optional)
external_reviewer is slug of external review user. (Optional)
external_approver is slug of external approve user. (Optional)
"""
endpoint = "tasks/image/" + task_id
payload = {}
if status:
payload["status"] = status
if external_status:
payload["externalStatus"] = external_status
if tags:
payload["tags"] = tags
if annotations:
for annotation in annotations:
# Since the content name is not passed in the sdk update api, the content will be filled on the server side.
annotation["content"] = ""
payload["annotations"] = annotations

self.__fill_assign_users(payload, **kwargs)

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

def update_image_classification_task(
self,
task_id: str,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="fastlabel",
version="0.11.9",
version="0.11.10",
author="eisuke-ueta",
author_email="eisuke.ueta@fastlabel.ai",
description="The official Python SDK for FastLabel API, the Data Platform for AI",
Expand Down