label-studio-sdk 2.0.1__py3-none-any.whl → 2.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of label-studio-sdk might be problematic. Click here for more details.
- label_studio_sdk/__init__.py +20 -0
- label_studio_sdk/actions/client.py +13 -13
- label_studio_sdk/actions/types/actions_list_response_item.py +3 -3
- label_studio_sdk/actions/types/actions_list_response_item_dialog.py +2 -2
- label_studio_sdk/annotations/client.py +441 -441
- label_studio_sdk/base_client.py +4 -0
- label_studio_sdk/comments/client.py +176 -176
- label_studio_sdk/export_storage/azure/client.py +274 -274
- label_studio_sdk/export_storage/gcs/client.py +263 -263
- label_studio_sdk/export_storage/local/client.py +206 -206
- label_studio_sdk/export_storage/redis/client.py +287 -287
- label_studio_sdk/export_storage/s3/client.py +347 -347
- label_studio_sdk/export_storage/s3s/client.py +678 -678
- label_studio_sdk/import_storage/azure/client.py +357 -357
- label_studio_sdk/import_storage/gcs/client.py +357 -357
- label_studio_sdk/import_storage/local/client.py +206 -206
- label_studio_sdk/import_storage/redis/client.py +309 -309
- label_studio_sdk/import_storage/s3/client.py +452 -452
- label_studio_sdk/import_storage/s3s/client.py +735 -735
- label_studio_sdk/jwt_settings/client.py +10 -10
- label_studio_sdk/ml/client.py +118 -118
- label_studio_sdk/ml/types/ml_list_model_versions_response.py +1 -1
- label_studio_sdk/model_providers/client.py +181 -181
- label_studio_sdk/organizations/members/client.py +8 -8
- label_studio_sdk/predictions/client.py +60 -60
- label_studio_sdk/projects/__init__.py +33 -1
- label_studio_sdk/projects/assignments/__init__.py +35 -0
- label_studio_sdk/projects/assignments/client.py +801 -0
- label_studio_sdk/projects/assignments/types/__init__.py +37 -0
- label_studio_sdk/projects/assignments/types/assignments_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters.py +33 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_conjunction.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item.py +44 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_filter.py +31 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_operator.py +23 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_value.py +7 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items.py +9 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_excluded.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_included.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_response.py +22 -0
- label_studio_sdk/projects/assignments/types/assignments_delete_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_update_request_type.py +5 -0
- label_studio_sdk/projects/client.py +445 -425
- label_studio_sdk/projects/exports/client.py +55 -55
- label_studio_sdk/projects/exports/types/exports_convert_response.py +1 -1
- label_studio_sdk/projects/members/__init__.py +2 -0
- label_studio_sdk/projects/members/client.py +137 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response.py +5 -5
- label_studio_sdk/projects/types/projects_import_tasks_response.py +12 -12
- label_studio_sdk/prompts/client.py +211 -211
- label_studio_sdk/prompts/runs/client.py +33 -33
- label_studio_sdk/prompts/versions/client.py +72 -72
- label_studio_sdk/sso/__init__.py +5 -0
- label_studio_sdk/sso/client.py +22 -0
- label_studio_sdk/sso/saml/__init__.py +2 -0
- label_studio_sdk/sso/saml/client.py +278 -0
- label_studio_sdk/sso/scim/__init__.py +2 -0
- label_studio_sdk/sso/scim/client.py +278 -0
- label_studio_sdk/tasks/client.py +174 -174
- label_studio_sdk/types/__init__.py +18 -0
- label_studio_sdk/types/all_roles_project_list.py +94 -94
- label_studio_sdk/types/annotation.py +35 -35
- label_studio_sdk/types/annotation_request.py +27 -27
- label_studio_sdk/types/azure_blob_export_storage.py +29 -29
- label_studio_sdk/types/azure_blob_import_storage.py +33 -33
- label_studio_sdk/types/batch_failed_predictions.py +1 -1
- label_studio_sdk/types/billing_checks.py +14 -14
- label_studio_sdk/types/billing_flags.py +16 -16
- label_studio_sdk/types/blueprint_list.py +7 -8
- label_studio_sdk/types/child_filter.py +11 -10
- label_studio_sdk/types/comment.py +15 -15
- label_studio_sdk/types/comment_request.py +7 -8
- label_studio_sdk/types/comment_serializer_with_expanded_user.py +17 -18
- label_studio_sdk/types/converted_format.py +1 -1
- label_studio_sdk/types/converted_format_request.py +1 -1
- label_studio_sdk/types/export.py +8 -8
- label_studio_sdk/types/file_upload.py +3 -2
- label_studio_sdk/types/filter.py +10 -9
- label_studio_sdk/types/filter_group.py +4 -3
- label_studio_sdk/types/gcs_export_storage.py +23 -23
- label_studio_sdk/types/gcs_import_storage.py +27 -27
- label_studio_sdk/types/import_api_request.py +26 -26
- label_studio_sdk/types/inference_run_cost_estimate.py +10 -10
- label_studio_sdk/types/local_files_export_storage.py +23 -23
- label_studio_sdk/types/local_files_import_storage.py +26 -26
- label_studio_sdk/types/lse_annotation_filter_options.py +10 -10
- label_studio_sdk/types/lse_annotation_filter_options_request.py +10 -10
- label_studio_sdk/types/lse_export_create.py +12 -12
- label_studio_sdk/types/lse_fields.py +14 -14
- label_studio_sdk/types/lse_organization.py +17 -17
- label_studio_sdk/types/lse_organization_member_list.py +1 -1
- label_studio_sdk/types/lse_project_create.py +72 -72
- label_studio_sdk/types/lse_project_update.py +89 -89
- label_studio_sdk/types/lse_s3export_storage.py +46 -46
- label_studio_sdk/types/lse_s3export_storage_request.py +43 -43
- label_studio_sdk/types/lse_s3import_storage.py +53 -53
- label_studio_sdk/types/lse_s3import_storage_request.py +49 -49
- label_studio_sdk/types/lse_task.py +49 -49
- label_studio_sdk/types/lse_task_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_filter_options.py +14 -14
- label_studio_sdk/types/lse_task_filter_options_request.py +14 -14
- label_studio_sdk/types/lse_task_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_annotators.py +12 -12
- label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +49 -49
- label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +5 -5
- label_studio_sdk/types/lse_user.py +13 -13
- label_studio_sdk/types/lse_user_api.py +11 -11
- label_studio_sdk/types/lse_user_organization_member_list.py +13 -13
- label_studio_sdk/types/lseapi_token_create.py +1 -1
- label_studio_sdk/types/lseapi_token_list.py +1 -1
- label_studio_sdk/types/lsejwt_settings.py +5 -5
- label_studio_sdk/types/ml_backend.py +27 -28
- label_studio_sdk/types/model_interface.py +12 -12
- label_studio_sdk/types/model_interface_request.py +7 -8
- label_studio_sdk/types/model_interface_serializer_get.py +13 -13
- label_studio_sdk/types/model_provider_connection.py +34 -34
- label_studio_sdk/types/model_provider_connection_request.py +15 -14
- label_studio_sdk/types/model_run.py +12 -12
- label_studio_sdk/types/organization_billing.py +1 -1
- label_studio_sdk/types/organization_id.py +2 -2
- label_studio_sdk/types/organization_invite.py +1 -1
- label_studio_sdk/types/organization_member.py +8 -9
- label_studio_sdk/types/organization_membership.py +2 -1
- label_studio_sdk/types/pause.py +23 -23
- label_studio_sdk/types/prediction.py +21 -21
- label_studio_sdk/types/prediction_request.py +16 -16
- label_studio_sdk/types/project.py +72 -72
- label_studio_sdk/types/project_group.py +22 -0
- label_studio_sdk/types/project_group_request.py +22 -0
- label_studio_sdk/types/project_group_role_enum.py +5 -0
- label_studio_sdk/types/project_import.py +21 -21
- label_studio_sdk/types/redis_export_storage.py +34 -34
- label_studio_sdk/types/redis_import_storage.py +37 -37
- label_studio_sdk/types/refined_prompt_response.py +11 -11
- label_studio_sdk/types/review_settings.py +29 -30
- label_studio_sdk/types/review_settings_request.py +29 -30
- label_studio_sdk/types/s3export_storage.py +45 -45
- label_studio_sdk/types/s3import_storage.py +44 -44
- label_studio_sdk/types/saml_settings.py +21 -0
- label_studio_sdk/types/saml_settings_update.py +22 -0
- label_studio_sdk/types/scim_settings.py +21 -0
- label_studio_sdk/types/scim_settings_update.py +22 -0
- label_studio_sdk/types/selected_items_request.py +1 -1
- label_studio_sdk/types/serialization_options.py +10 -10
- label_studio_sdk/types/serialization_options_request.py +10 -10
- label_studio_sdk/types/task_assignment.py +43 -0
- label_studio_sdk/types/third_party_model_version.py +11 -11
- label_studio_sdk/types/third_party_model_version_request.py +6 -7
- label_studio_sdk/types/type_enum.py +5 -0
- label_studio_sdk/types/user_simple.py +3 -3
- label_studio_sdk/types/user_simple_request.py +1 -1
- label_studio_sdk/types/version_response.py +19 -20
- label_studio_sdk/types/view.py +8 -8
- label_studio_sdk/types/webhook.py +16 -16
- label_studio_sdk/types/webhook_serializer_for_update.py +16 -16
- label_studio_sdk/types/workspace.py +10 -11
- label_studio_sdk/users/client.py +160 -160
- label_studio_sdk/views/client.py +164 -164
- label_studio_sdk/webhooks/client.py +183 -183
- label_studio_sdk/webhooks/types/webhooks_info_response.py +32 -32
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +1 -1
- label_studio_sdk/workspaces/client.py +40 -40
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.3.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.3.dist-info}/RECORD +184 -150
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.3.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.3.dist-info}/WHEEL +0 -0
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
-
from ..core.request_options import RequestOptions
|
|
6
|
-
from ..types.annotation import Annotation
|
|
7
|
-
from ..core.jsonable_encoder import jsonable_encoder
|
|
8
|
-
from ..core.unchecked_base_model import construct_type
|
|
9
|
-
from json.decoder import JSONDecodeError
|
|
10
|
-
from ..core.api_error import ApiError
|
|
11
|
-
from ..types.selected_items_request import SelectedItemsRequest
|
|
12
5
|
import datetime as dt
|
|
13
6
|
from .types.annotation_bulk_serializer_with_selected_items_request_last_action import (
|
|
14
7
|
AnnotationBulkSerializerWithSelectedItemsRequestLastAction,
|
|
15
8
|
)
|
|
9
|
+
from ..types.selected_items_request import SelectedItemsRequest
|
|
10
|
+
from ..core.request_options import RequestOptions
|
|
16
11
|
from .types.annotations_create_bulk_response_item import AnnotationsCreateBulkResponseItem
|
|
17
12
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
13
|
+
from ..core.unchecked_base_model import construct_type
|
|
14
|
+
from json.decoder import JSONDecodeError
|
|
15
|
+
from ..core.api_error import ApiError
|
|
16
|
+
from ..types.annotation import Annotation
|
|
17
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
18
18
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
19
19
|
|
|
20
20
|
# this is used as the default value for optional parameters
|
|
@@ -25,6 +25,161 @@ class AnnotationsClient:
|
|
|
25
25
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
26
|
self._client_wrapper = client_wrapper
|
|
27
27
|
|
|
28
|
+
def create_bulk(
|
|
29
|
+
self,
|
|
30
|
+
*,
|
|
31
|
+
bulk_created: typing.Optional[bool] = OMIT,
|
|
32
|
+
completed_by: typing.Optional[int] = OMIT,
|
|
33
|
+
draft_created_at: typing.Optional[dt.datetime] = OMIT,
|
|
34
|
+
ground_truth: typing.Optional[bool] = OMIT,
|
|
35
|
+
import_id: typing.Optional[int] = OMIT,
|
|
36
|
+
last_action: typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction] = OMIT,
|
|
37
|
+
last_created_by: typing.Optional[int] = OMIT,
|
|
38
|
+
lead_time: typing.Optional[float] = OMIT,
|
|
39
|
+
parent_annotation: typing.Optional[int] = OMIT,
|
|
40
|
+
parent_prediction: typing.Optional[int] = OMIT,
|
|
41
|
+
project: typing.Optional[int] = OMIT,
|
|
42
|
+
result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
43
|
+
selected_items: typing.Optional[SelectedItemsRequest] = OMIT,
|
|
44
|
+
task: typing.Optional[int] = OMIT,
|
|
45
|
+
tasks: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
46
|
+
unique_id: typing.Optional[str] = OMIT,
|
|
47
|
+
updated_by: typing.Optional[int] = OMIT,
|
|
48
|
+
was_cancelled: typing.Optional[bool] = OMIT,
|
|
49
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
50
|
+
) -> typing.List[AnnotationsCreateBulkResponseItem]:
|
|
51
|
+
"""
|
|
52
|
+
Create multiple annotations at once
|
|
53
|
+
|
|
54
|
+
Parameters
|
|
55
|
+
----------
|
|
56
|
+
bulk_created : typing.Optional[bool]
|
|
57
|
+
Annotation was created in bulk mode
|
|
58
|
+
|
|
59
|
+
completed_by : typing.Optional[int]
|
|
60
|
+
|
|
61
|
+
draft_created_at : typing.Optional[dt.datetime]
|
|
62
|
+
Draft creation time
|
|
63
|
+
|
|
64
|
+
ground_truth : typing.Optional[bool]
|
|
65
|
+
This annotation is a Ground Truth (ground_truth)
|
|
66
|
+
|
|
67
|
+
import_id : typing.Optional[int]
|
|
68
|
+
Original annotation ID that was at the import step or NULL if this annotation wasn't imported
|
|
69
|
+
|
|
70
|
+
last_action : typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction]
|
|
71
|
+
Action which was performed in the last annotation history item
|
|
72
|
+
|
|
73
|
+
* `prediction` - Created from prediction
|
|
74
|
+
* `propagated_annotation` - Created from another annotation
|
|
75
|
+
* `imported` - Imported
|
|
76
|
+
* `submitted` - Submitted
|
|
77
|
+
* `updated` - Updated
|
|
78
|
+
* `skipped` - Skipped
|
|
79
|
+
* `accepted` - Accepted
|
|
80
|
+
* `rejected` - Rejected
|
|
81
|
+
* `fixed_and_accepted` - Fixed and accepted
|
|
82
|
+
* `deleted_review` - Deleted review
|
|
83
|
+
|
|
84
|
+
last_created_by : typing.Optional[int]
|
|
85
|
+
User who created the last annotation history item
|
|
86
|
+
|
|
87
|
+
lead_time : typing.Optional[float]
|
|
88
|
+
How much time it took to annotate the task
|
|
89
|
+
|
|
90
|
+
parent_annotation : typing.Optional[int]
|
|
91
|
+
Points to the parent annotation from which this annotation was created
|
|
92
|
+
|
|
93
|
+
parent_prediction : typing.Optional[int]
|
|
94
|
+
Points to the prediction from which this annotation was created
|
|
95
|
+
|
|
96
|
+
project : typing.Optional[int]
|
|
97
|
+
Project ID for this annotation
|
|
98
|
+
|
|
99
|
+
result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
100
|
+
List of annotation results for the task
|
|
101
|
+
|
|
102
|
+
selected_items : typing.Optional[SelectedItemsRequest]
|
|
103
|
+
|
|
104
|
+
task : typing.Optional[int]
|
|
105
|
+
Corresponding task for this annotation
|
|
106
|
+
|
|
107
|
+
tasks : typing.Optional[typing.Sequence[int]]
|
|
108
|
+
|
|
109
|
+
unique_id : typing.Optional[str]
|
|
110
|
+
|
|
111
|
+
updated_by : typing.Optional[int]
|
|
112
|
+
Last user who updated this annotation
|
|
113
|
+
|
|
114
|
+
was_cancelled : typing.Optional[bool]
|
|
115
|
+
User skipped the task
|
|
116
|
+
|
|
117
|
+
request_options : typing.Optional[RequestOptions]
|
|
118
|
+
Request-specific configuration.
|
|
119
|
+
|
|
120
|
+
Returns
|
|
121
|
+
-------
|
|
122
|
+
typing.List[AnnotationsCreateBulkResponseItem]
|
|
123
|
+
Bulk annotations created successfully
|
|
124
|
+
|
|
125
|
+
Examples
|
|
126
|
+
--------
|
|
127
|
+
from label_studio_sdk import LabelStudio
|
|
128
|
+
|
|
129
|
+
client = LabelStudio(
|
|
130
|
+
api_key="YOUR_API_KEY",
|
|
131
|
+
)
|
|
132
|
+
client.annotations.create_bulk()
|
|
133
|
+
"""
|
|
134
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
135
|
+
"api/annotations/bulk/",
|
|
136
|
+
method="POST",
|
|
137
|
+
json={
|
|
138
|
+
"bulk_created": bulk_created,
|
|
139
|
+
"completed_by": completed_by,
|
|
140
|
+
"draft_created_at": draft_created_at,
|
|
141
|
+
"ground_truth": ground_truth,
|
|
142
|
+
"import_id": import_id,
|
|
143
|
+
"last_action": convert_and_respect_annotation_metadata(
|
|
144
|
+
object_=last_action,
|
|
145
|
+
annotation=AnnotationBulkSerializerWithSelectedItemsRequestLastAction,
|
|
146
|
+
direction="write",
|
|
147
|
+
),
|
|
148
|
+
"last_created_by": last_created_by,
|
|
149
|
+
"lead_time": lead_time,
|
|
150
|
+
"parent_annotation": parent_annotation,
|
|
151
|
+
"parent_prediction": parent_prediction,
|
|
152
|
+
"project": project,
|
|
153
|
+
"result": result,
|
|
154
|
+
"selected_items": convert_and_respect_annotation_metadata(
|
|
155
|
+
object_=selected_items, annotation=SelectedItemsRequest, direction="write"
|
|
156
|
+
),
|
|
157
|
+
"task": task,
|
|
158
|
+
"tasks": tasks,
|
|
159
|
+
"unique_id": unique_id,
|
|
160
|
+
"updated_by": updated_by,
|
|
161
|
+
"was_cancelled": was_cancelled,
|
|
162
|
+
},
|
|
163
|
+
headers={
|
|
164
|
+
"content-type": "application/json",
|
|
165
|
+
},
|
|
166
|
+
request_options=request_options,
|
|
167
|
+
omit=OMIT,
|
|
168
|
+
)
|
|
169
|
+
try:
|
|
170
|
+
if 200 <= _response.status_code < 300:
|
|
171
|
+
return typing.cast(
|
|
172
|
+
typing.List[AnnotationsCreateBulkResponseItem],
|
|
173
|
+
construct_type(
|
|
174
|
+
type_=typing.List[AnnotationsCreateBulkResponseItem], # type: ignore
|
|
175
|
+
object_=_response.json(),
|
|
176
|
+
),
|
|
177
|
+
)
|
|
178
|
+
_response_json = _response.json()
|
|
179
|
+
except JSONDecodeError:
|
|
180
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
181
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
182
|
+
|
|
28
183
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Annotation:
|
|
29
184
|
"""
|
|
30
185
|
Retrieve a specific annotation for a task using the annotation result ID.
|
|
@@ -114,14 +269,14 @@ class AnnotationsClient:
|
|
|
114
269
|
self,
|
|
115
270
|
id: int,
|
|
116
271
|
*,
|
|
272
|
+
completed_by: typing.Optional[int] = OMIT,
|
|
273
|
+
ground_truth: typing.Optional[bool] = OMIT,
|
|
274
|
+
lead_time: typing.Optional[float] = OMIT,
|
|
275
|
+
project: typing.Optional[int] = OMIT,
|
|
117
276
|
result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
118
277
|
task: typing.Optional[int] = OMIT,
|
|
119
|
-
project: typing.Optional[int] = OMIT,
|
|
120
|
-
completed_by: typing.Optional[int] = OMIT,
|
|
121
278
|
updated_by: typing.Optional[int] = OMIT,
|
|
122
279
|
was_cancelled: typing.Optional[bool] = OMIT,
|
|
123
|
-
ground_truth: typing.Optional[bool] = OMIT,
|
|
124
|
-
lead_time: typing.Optional[float] = OMIT,
|
|
125
280
|
request_options: typing.Optional[RequestOptions] = None,
|
|
126
281
|
) -> Annotation:
|
|
127
282
|
"""
|
|
@@ -131,17 +286,23 @@ class AnnotationsClient:
|
|
|
131
286
|
----------
|
|
132
287
|
id : int
|
|
133
288
|
|
|
134
|
-
|
|
135
|
-
|
|
289
|
+
completed_by : typing.Optional[int]
|
|
290
|
+
User ID of the person who created this annotation
|
|
136
291
|
|
|
137
|
-
|
|
138
|
-
|
|
292
|
+
ground_truth : typing.Optional[bool]
|
|
293
|
+
This annotation is a Ground Truth
|
|
294
|
+
|
|
295
|
+
lead_time : typing.Optional[float]
|
|
296
|
+
How much time it took to annotate the task (in seconds)
|
|
139
297
|
|
|
140
298
|
project : typing.Optional[int]
|
|
141
299
|
Project ID for this annotation
|
|
142
300
|
|
|
143
|
-
|
|
144
|
-
|
|
301
|
+
result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
302
|
+
Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)
|
|
303
|
+
|
|
304
|
+
task : typing.Optional[int]
|
|
305
|
+
Corresponding task for this annotation
|
|
145
306
|
|
|
146
307
|
updated_by : typing.Optional[int]
|
|
147
308
|
Last user who updated this annotation
|
|
@@ -149,12 +310,6 @@ class AnnotationsClient:
|
|
|
149
310
|
was_cancelled : typing.Optional[bool]
|
|
150
311
|
User skipped the task
|
|
151
312
|
|
|
152
|
-
ground_truth : typing.Optional[bool]
|
|
153
|
-
This annotation is a Ground Truth
|
|
154
|
-
|
|
155
|
-
lead_time : typing.Optional[float]
|
|
156
|
-
How much time it took to annotate the task (in seconds)
|
|
157
|
-
|
|
158
313
|
request_options : typing.Optional[RequestOptions]
|
|
159
314
|
Request-specific configuration.
|
|
160
315
|
|
|
@@ -172,195 +327,40 @@ class AnnotationsClient:
|
|
|
172
327
|
)
|
|
173
328
|
client.annotations.update(
|
|
174
329
|
id=1,
|
|
330
|
+
ground_truth=True,
|
|
175
331
|
result=[
|
|
176
332
|
{
|
|
177
|
-
"original_width": 1920,
|
|
178
|
-
"original_height": 1080,
|
|
179
|
-
"image_rotation": 0,
|
|
180
333
|
"from_name": "bboxes",
|
|
334
|
+
"image_rotation": 0,
|
|
335
|
+
"original_height": 1080,
|
|
336
|
+
"original_width": 1920,
|
|
181
337
|
"to_name": "image",
|
|
182
338
|
"type": "rectanglelabels",
|
|
183
339
|
"value": {
|
|
184
|
-
"x": 20,
|
|
185
|
-
"y": 30,
|
|
186
|
-
"width": 50,
|
|
187
340
|
"height": 60,
|
|
188
341
|
"rotation": 0,
|
|
189
342
|
"values": {"rectanglelabels": ["Person"]},
|
|
343
|
+
"width": 50,
|
|
344
|
+
"x": 20,
|
|
345
|
+
"y": 30,
|
|
190
346
|
},
|
|
191
347
|
}
|
|
192
348
|
],
|
|
193
349
|
was_cancelled=False,
|
|
194
|
-
ground_truth=True,
|
|
195
350
|
)
|
|
196
351
|
"""
|
|
197
352
|
_response = self._client_wrapper.httpx_client.request(
|
|
198
353
|
f"api/annotations/{jsonable_encoder(id)}/",
|
|
199
354
|
method="PATCH",
|
|
200
355
|
json={
|
|
201
|
-
"result": result,
|
|
202
|
-
"task": task,
|
|
203
|
-
"project": project,
|
|
204
356
|
"completed_by": completed_by,
|
|
205
|
-
"updated_by": updated_by,
|
|
206
|
-
"was_cancelled": was_cancelled,
|
|
207
357
|
"ground_truth": ground_truth,
|
|
208
358
|
"lead_time": lead_time,
|
|
209
|
-
},
|
|
210
|
-
headers={
|
|
211
|
-
"content-type": "application/json",
|
|
212
|
-
},
|
|
213
|
-
request_options=request_options,
|
|
214
|
-
omit=OMIT,
|
|
215
|
-
)
|
|
216
|
-
try:
|
|
217
|
-
if 200 <= _response.status_code < 300:
|
|
218
|
-
return typing.cast(
|
|
219
|
-
Annotation,
|
|
220
|
-
construct_type(
|
|
221
|
-
type_=Annotation, # type: ignore
|
|
222
|
-
object_=_response.json(),
|
|
223
|
-
),
|
|
224
|
-
)
|
|
225
|
-
_response_json = _response.json()
|
|
226
|
-
except JSONDecodeError:
|
|
227
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
228
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
229
|
-
|
|
230
|
-
def create_bulk(
|
|
231
|
-
self,
|
|
232
|
-
*,
|
|
233
|
-
result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
234
|
-
completed_by: typing.Optional[int] = OMIT,
|
|
235
|
-
unique_id: typing.Optional[str] = OMIT,
|
|
236
|
-
tasks: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
237
|
-
selected_items: typing.Optional[SelectedItemsRequest] = OMIT,
|
|
238
|
-
was_cancelled: typing.Optional[bool] = OMIT,
|
|
239
|
-
ground_truth: typing.Optional[bool] = OMIT,
|
|
240
|
-
draft_created_at: typing.Optional[dt.datetime] = OMIT,
|
|
241
|
-
lead_time: typing.Optional[float] = OMIT,
|
|
242
|
-
import_id: typing.Optional[int] = OMIT,
|
|
243
|
-
last_action: typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction] = OMIT,
|
|
244
|
-
bulk_created: typing.Optional[bool] = OMIT,
|
|
245
|
-
task: typing.Optional[int] = OMIT,
|
|
246
|
-
project: typing.Optional[int] = OMIT,
|
|
247
|
-
updated_by: typing.Optional[int] = OMIT,
|
|
248
|
-
parent_prediction: typing.Optional[int] = OMIT,
|
|
249
|
-
parent_annotation: typing.Optional[int] = OMIT,
|
|
250
|
-
last_created_by: typing.Optional[int] = OMIT,
|
|
251
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
252
|
-
) -> typing.List[AnnotationsCreateBulkResponseItem]:
|
|
253
|
-
"""
|
|
254
|
-
Create multiple annotations at once
|
|
255
|
-
|
|
256
|
-
Parameters
|
|
257
|
-
----------
|
|
258
|
-
result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
259
|
-
List of annotation results for the task
|
|
260
|
-
|
|
261
|
-
completed_by : typing.Optional[int]
|
|
262
|
-
|
|
263
|
-
unique_id : typing.Optional[str]
|
|
264
|
-
|
|
265
|
-
tasks : typing.Optional[typing.Sequence[int]]
|
|
266
|
-
|
|
267
|
-
selected_items : typing.Optional[SelectedItemsRequest]
|
|
268
|
-
|
|
269
|
-
was_cancelled : typing.Optional[bool]
|
|
270
|
-
User skipped the task
|
|
271
|
-
|
|
272
|
-
ground_truth : typing.Optional[bool]
|
|
273
|
-
This annotation is a Ground Truth (ground_truth)
|
|
274
|
-
|
|
275
|
-
draft_created_at : typing.Optional[dt.datetime]
|
|
276
|
-
Draft creation time
|
|
277
|
-
|
|
278
|
-
lead_time : typing.Optional[float]
|
|
279
|
-
How much time it took to annotate the task
|
|
280
|
-
|
|
281
|
-
import_id : typing.Optional[int]
|
|
282
|
-
Original annotation ID that was at the import step or NULL if this annotation wasn't imported
|
|
283
|
-
|
|
284
|
-
last_action : typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction]
|
|
285
|
-
Action which was performed in the last annotation history item
|
|
286
|
-
|
|
287
|
-
* `prediction` - Created from prediction
|
|
288
|
-
* `propagated_annotation` - Created from another annotation
|
|
289
|
-
* `imported` - Imported
|
|
290
|
-
* `submitted` - Submitted
|
|
291
|
-
* `updated` - Updated
|
|
292
|
-
* `skipped` - Skipped
|
|
293
|
-
* `accepted` - Accepted
|
|
294
|
-
* `rejected` - Rejected
|
|
295
|
-
* `fixed_and_accepted` - Fixed and accepted
|
|
296
|
-
* `deleted_review` - Deleted review
|
|
297
|
-
|
|
298
|
-
bulk_created : typing.Optional[bool]
|
|
299
|
-
Annotation was created in bulk mode
|
|
300
|
-
|
|
301
|
-
task : typing.Optional[int]
|
|
302
|
-
Corresponding task for this annotation
|
|
303
|
-
|
|
304
|
-
project : typing.Optional[int]
|
|
305
|
-
Project ID for this annotation
|
|
306
|
-
|
|
307
|
-
updated_by : typing.Optional[int]
|
|
308
|
-
Last user who updated this annotation
|
|
309
|
-
|
|
310
|
-
parent_prediction : typing.Optional[int]
|
|
311
|
-
Points to the prediction from which this annotation was created
|
|
312
|
-
|
|
313
|
-
parent_annotation : typing.Optional[int]
|
|
314
|
-
Points to the parent annotation from which this annotation was created
|
|
315
|
-
|
|
316
|
-
last_created_by : typing.Optional[int]
|
|
317
|
-
User who created the last annotation history item
|
|
318
|
-
|
|
319
|
-
request_options : typing.Optional[RequestOptions]
|
|
320
|
-
Request-specific configuration.
|
|
321
|
-
|
|
322
|
-
Returns
|
|
323
|
-
-------
|
|
324
|
-
typing.List[AnnotationsCreateBulkResponseItem]
|
|
325
|
-
Bulk annotations created successfully
|
|
326
|
-
|
|
327
|
-
Examples
|
|
328
|
-
--------
|
|
329
|
-
from label_studio_sdk import LabelStudio
|
|
330
|
-
|
|
331
|
-
client = LabelStudio(
|
|
332
|
-
api_key="YOUR_API_KEY",
|
|
333
|
-
)
|
|
334
|
-
client.annotations.create_bulk()
|
|
335
|
-
"""
|
|
336
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
337
|
-
"api/annotations/bulk/",
|
|
338
|
-
method="POST",
|
|
339
|
-
json={
|
|
340
|
-
"result": result,
|
|
341
|
-
"completed_by": completed_by,
|
|
342
|
-
"unique_id": unique_id,
|
|
343
|
-
"tasks": tasks,
|
|
344
|
-
"selected_items": convert_and_respect_annotation_metadata(
|
|
345
|
-
object_=selected_items, annotation=SelectedItemsRequest, direction="write"
|
|
346
|
-
),
|
|
347
|
-
"was_cancelled": was_cancelled,
|
|
348
|
-
"ground_truth": ground_truth,
|
|
349
|
-
"draft_created_at": draft_created_at,
|
|
350
|
-
"lead_time": lead_time,
|
|
351
|
-
"import_id": import_id,
|
|
352
|
-
"last_action": convert_and_respect_annotation_metadata(
|
|
353
|
-
object_=last_action,
|
|
354
|
-
annotation=AnnotationBulkSerializerWithSelectedItemsRequestLastAction,
|
|
355
|
-
direction="write",
|
|
356
|
-
),
|
|
357
|
-
"bulk_created": bulk_created,
|
|
358
|
-
"task": task,
|
|
359
359
|
"project": project,
|
|
360
|
+
"result": result,
|
|
361
|
+
"task": task,
|
|
360
362
|
"updated_by": updated_by,
|
|
361
|
-
"
|
|
362
|
-
"parent_annotation": parent_annotation,
|
|
363
|
-
"last_created_by": last_created_by,
|
|
363
|
+
"was_cancelled": was_cancelled,
|
|
364
364
|
},
|
|
365
365
|
headers={
|
|
366
366
|
"content-type": "application/json",
|
|
@@ -371,9 +371,9 @@ class AnnotationsClient:
|
|
|
371
371
|
try:
|
|
372
372
|
if 200 <= _response.status_code < 300:
|
|
373
373
|
return typing.cast(
|
|
374
|
-
|
|
374
|
+
Annotation,
|
|
375
375
|
construct_type(
|
|
376
|
-
type_=
|
|
376
|
+
type_=Annotation, # type: ignore
|
|
377
377
|
object_=_response.json(),
|
|
378
378
|
),
|
|
379
379
|
)
|
|
@@ -441,14 +441,14 @@ class AnnotationsClient:
|
|
|
441
441
|
self,
|
|
442
442
|
id: int,
|
|
443
443
|
*,
|
|
444
|
+
completed_by: typing.Optional[int] = OMIT,
|
|
445
|
+
ground_truth: typing.Optional[bool] = OMIT,
|
|
446
|
+
lead_time: typing.Optional[float] = OMIT,
|
|
447
|
+
project: typing.Optional[int] = OMIT,
|
|
444
448
|
result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
445
449
|
task: typing.Optional[int] = OMIT,
|
|
446
|
-
project: typing.Optional[int] = OMIT,
|
|
447
|
-
completed_by: typing.Optional[int] = OMIT,
|
|
448
450
|
updated_by: typing.Optional[int] = OMIT,
|
|
449
451
|
was_cancelled: typing.Optional[bool] = OMIT,
|
|
450
|
-
ground_truth: typing.Optional[bool] = OMIT,
|
|
451
|
-
lead_time: typing.Optional[float] = OMIT,
|
|
452
452
|
request_options: typing.Optional[RequestOptions] = None,
|
|
453
453
|
) -> Annotation:
|
|
454
454
|
"""
|
|
@@ -474,17 +474,23 @@ class AnnotationsClient:
|
|
|
474
474
|
id : int
|
|
475
475
|
Task ID
|
|
476
476
|
|
|
477
|
-
|
|
478
|
-
|
|
477
|
+
completed_by : typing.Optional[int]
|
|
478
|
+
User ID of the person who created this annotation
|
|
479
479
|
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
ground_truth : typing.Optional[bool]
|
|
481
|
+
This annotation is a Ground Truth
|
|
482
|
+
|
|
483
|
+
lead_time : typing.Optional[float]
|
|
484
|
+
How much time it took to annotate the task (in seconds)
|
|
482
485
|
|
|
483
486
|
project : typing.Optional[int]
|
|
484
487
|
Project ID for this annotation
|
|
485
488
|
|
|
486
|
-
|
|
487
|
-
|
|
489
|
+
result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
490
|
+
Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)
|
|
491
|
+
|
|
492
|
+
task : typing.Optional[int]
|
|
493
|
+
Corresponding task for this annotation
|
|
488
494
|
|
|
489
495
|
updated_by : typing.Optional[int]
|
|
490
496
|
Last user who updated this annotation
|
|
@@ -492,12 +498,6 @@ class AnnotationsClient:
|
|
|
492
498
|
was_cancelled : typing.Optional[bool]
|
|
493
499
|
User skipped the task
|
|
494
500
|
|
|
495
|
-
ground_truth : typing.Optional[bool]
|
|
496
|
-
This annotation is a Ground Truth
|
|
497
|
-
|
|
498
|
-
lead_time : typing.Optional[float]
|
|
499
|
-
How much time it took to annotate the task (in seconds)
|
|
500
|
-
|
|
501
501
|
request_options : typing.Optional[RequestOptions]
|
|
502
502
|
Request-specific configuration.
|
|
503
503
|
|
|
@@ -515,40 +515,40 @@ class AnnotationsClient:
|
|
|
515
515
|
)
|
|
516
516
|
client.annotations.create(
|
|
517
517
|
id=1,
|
|
518
|
+
ground_truth=True,
|
|
518
519
|
result=[
|
|
519
520
|
{
|
|
520
|
-
"original_width": 1920,
|
|
521
|
-
"original_height": 1080,
|
|
522
|
-
"image_rotation": 0,
|
|
523
521
|
"from_name": "bboxes",
|
|
522
|
+
"image_rotation": 0,
|
|
523
|
+
"original_height": 1080,
|
|
524
|
+
"original_width": 1920,
|
|
524
525
|
"to_name": "image",
|
|
525
526
|
"type": "rectanglelabels",
|
|
526
527
|
"value": {
|
|
527
|
-
"x": 20,
|
|
528
|
-
"y": 30,
|
|
529
|
-
"width": 50,
|
|
530
528
|
"height": 60,
|
|
531
529
|
"rotation": 0,
|
|
532
530
|
"values": {"rectanglelabels": ["Person"]},
|
|
531
|
+
"width": 50,
|
|
532
|
+
"x": 20,
|
|
533
|
+
"y": 30,
|
|
533
534
|
},
|
|
534
535
|
}
|
|
535
536
|
],
|
|
536
537
|
was_cancelled=False,
|
|
537
|
-
ground_truth=True,
|
|
538
538
|
)
|
|
539
539
|
"""
|
|
540
540
|
_response = self._client_wrapper.httpx_client.request(
|
|
541
541
|
f"api/tasks/{jsonable_encoder(id)}/annotations/",
|
|
542
542
|
method="POST",
|
|
543
543
|
json={
|
|
544
|
+
"completed_by": completed_by,
|
|
545
|
+
"ground_truth": ground_truth,
|
|
546
|
+
"lead_time": lead_time,
|
|
547
|
+
"project": project,
|
|
544
548
|
"result": result,
|
|
545
549
|
"task": task,
|
|
546
|
-
"project": project,
|
|
547
|
-
"completed_by": completed_by,
|
|
548
550
|
"updated_by": updated_by,
|
|
549
551
|
"was_cancelled": was_cancelled,
|
|
550
|
-
"ground_truth": ground_truth,
|
|
551
|
-
"lead_time": lead_time,
|
|
552
552
|
},
|
|
553
553
|
headers={
|
|
554
554
|
"content-type": "application/json",
|
|
@@ -575,21 +575,102 @@ class AsyncAnnotationsClient:
|
|
|
575
575
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
576
576
|
self._client_wrapper = client_wrapper
|
|
577
577
|
|
|
578
|
-
async def
|
|
578
|
+
async def create_bulk(
|
|
579
|
+
self,
|
|
580
|
+
*,
|
|
581
|
+
bulk_created: typing.Optional[bool] = OMIT,
|
|
582
|
+
completed_by: typing.Optional[int] = OMIT,
|
|
583
|
+
draft_created_at: typing.Optional[dt.datetime] = OMIT,
|
|
584
|
+
ground_truth: typing.Optional[bool] = OMIT,
|
|
585
|
+
import_id: typing.Optional[int] = OMIT,
|
|
586
|
+
last_action: typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction] = OMIT,
|
|
587
|
+
last_created_by: typing.Optional[int] = OMIT,
|
|
588
|
+
lead_time: typing.Optional[float] = OMIT,
|
|
589
|
+
parent_annotation: typing.Optional[int] = OMIT,
|
|
590
|
+
parent_prediction: typing.Optional[int] = OMIT,
|
|
591
|
+
project: typing.Optional[int] = OMIT,
|
|
592
|
+
result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
593
|
+
selected_items: typing.Optional[SelectedItemsRequest] = OMIT,
|
|
594
|
+
task: typing.Optional[int] = OMIT,
|
|
595
|
+
tasks: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
596
|
+
unique_id: typing.Optional[str] = OMIT,
|
|
597
|
+
updated_by: typing.Optional[int] = OMIT,
|
|
598
|
+
was_cancelled: typing.Optional[bool] = OMIT,
|
|
599
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
600
|
+
) -> typing.List[AnnotationsCreateBulkResponseItem]:
|
|
579
601
|
"""
|
|
580
|
-
|
|
602
|
+
Create multiple annotations at once
|
|
581
603
|
|
|
582
604
|
Parameters
|
|
583
605
|
----------
|
|
584
|
-
|
|
606
|
+
bulk_created : typing.Optional[bool]
|
|
607
|
+
Annotation was created in bulk mode
|
|
608
|
+
|
|
609
|
+
completed_by : typing.Optional[int]
|
|
610
|
+
|
|
611
|
+
draft_created_at : typing.Optional[dt.datetime]
|
|
612
|
+
Draft creation time
|
|
613
|
+
|
|
614
|
+
ground_truth : typing.Optional[bool]
|
|
615
|
+
This annotation is a Ground Truth (ground_truth)
|
|
616
|
+
|
|
617
|
+
import_id : typing.Optional[int]
|
|
618
|
+
Original annotation ID that was at the import step or NULL if this annotation wasn't imported
|
|
619
|
+
|
|
620
|
+
last_action : typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction]
|
|
621
|
+
Action which was performed in the last annotation history item
|
|
622
|
+
|
|
623
|
+
* `prediction` - Created from prediction
|
|
624
|
+
* `propagated_annotation` - Created from another annotation
|
|
625
|
+
* `imported` - Imported
|
|
626
|
+
* `submitted` - Submitted
|
|
627
|
+
* `updated` - Updated
|
|
628
|
+
* `skipped` - Skipped
|
|
629
|
+
* `accepted` - Accepted
|
|
630
|
+
* `rejected` - Rejected
|
|
631
|
+
* `fixed_and_accepted` - Fixed and accepted
|
|
632
|
+
* `deleted_review` - Deleted review
|
|
633
|
+
|
|
634
|
+
last_created_by : typing.Optional[int]
|
|
635
|
+
User who created the last annotation history item
|
|
636
|
+
|
|
637
|
+
lead_time : typing.Optional[float]
|
|
638
|
+
How much time it took to annotate the task
|
|
639
|
+
|
|
640
|
+
parent_annotation : typing.Optional[int]
|
|
641
|
+
Points to the parent annotation from which this annotation was created
|
|
642
|
+
|
|
643
|
+
parent_prediction : typing.Optional[int]
|
|
644
|
+
Points to the prediction from which this annotation was created
|
|
645
|
+
|
|
646
|
+
project : typing.Optional[int]
|
|
647
|
+
Project ID for this annotation
|
|
648
|
+
|
|
649
|
+
result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
650
|
+
List of annotation results for the task
|
|
651
|
+
|
|
652
|
+
selected_items : typing.Optional[SelectedItemsRequest]
|
|
653
|
+
|
|
654
|
+
task : typing.Optional[int]
|
|
655
|
+
Corresponding task for this annotation
|
|
656
|
+
|
|
657
|
+
tasks : typing.Optional[typing.Sequence[int]]
|
|
658
|
+
|
|
659
|
+
unique_id : typing.Optional[str]
|
|
660
|
+
|
|
661
|
+
updated_by : typing.Optional[int]
|
|
662
|
+
Last user who updated this annotation
|
|
663
|
+
|
|
664
|
+
was_cancelled : typing.Optional[bool]
|
|
665
|
+
User skipped the task
|
|
585
666
|
|
|
586
667
|
request_options : typing.Optional[RequestOptions]
|
|
587
668
|
Request-specific configuration.
|
|
588
669
|
|
|
589
670
|
Returns
|
|
590
671
|
-------
|
|
591
|
-
|
|
592
|
-
|
|
672
|
+
typing.List[AnnotationsCreateBulkResponseItem]
|
|
673
|
+
Bulk annotations created successfully
|
|
593
674
|
|
|
594
675
|
Examples
|
|
595
676
|
--------
|
|
@@ -603,24 +684,52 @@ class AsyncAnnotationsClient:
|
|
|
603
684
|
|
|
604
685
|
|
|
605
686
|
async def main() -> None:
|
|
606
|
-
await client.annotations.
|
|
607
|
-
id=1,
|
|
608
|
-
)
|
|
687
|
+
await client.annotations.create_bulk()
|
|
609
688
|
|
|
610
689
|
|
|
611
690
|
asyncio.run(main())
|
|
612
691
|
"""
|
|
613
692
|
_response = await self._client_wrapper.httpx_client.request(
|
|
614
|
-
|
|
615
|
-
method="
|
|
693
|
+
"api/annotations/bulk/",
|
|
694
|
+
method="POST",
|
|
695
|
+
json={
|
|
696
|
+
"bulk_created": bulk_created,
|
|
697
|
+
"completed_by": completed_by,
|
|
698
|
+
"draft_created_at": draft_created_at,
|
|
699
|
+
"ground_truth": ground_truth,
|
|
700
|
+
"import_id": import_id,
|
|
701
|
+
"last_action": convert_and_respect_annotation_metadata(
|
|
702
|
+
object_=last_action,
|
|
703
|
+
annotation=AnnotationBulkSerializerWithSelectedItemsRequestLastAction,
|
|
704
|
+
direction="write",
|
|
705
|
+
),
|
|
706
|
+
"last_created_by": last_created_by,
|
|
707
|
+
"lead_time": lead_time,
|
|
708
|
+
"parent_annotation": parent_annotation,
|
|
709
|
+
"parent_prediction": parent_prediction,
|
|
710
|
+
"project": project,
|
|
711
|
+
"result": result,
|
|
712
|
+
"selected_items": convert_and_respect_annotation_metadata(
|
|
713
|
+
object_=selected_items, annotation=SelectedItemsRequest, direction="write"
|
|
714
|
+
),
|
|
715
|
+
"task": task,
|
|
716
|
+
"tasks": tasks,
|
|
717
|
+
"unique_id": unique_id,
|
|
718
|
+
"updated_by": updated_by,
|
|
719
|
+
"was_cancelled": was_cancelled,
|
|
720
|
+
},
|
|
721
|
+
headers={
|
|
722
|
+
"content-type": "application/json",
|
|
723
|
+
},
|
|
616
724
|
request_options=request_options,
|
|
725
|
+
omit=OMIT,
|
|
617
726
|
)
|
|
618
727
|
try:
|
|
619
728
|
if 200 <= _response.status_code < 300:
|
|
620
729
|
return typing.cast(
|
|
621
|
-
|
|
730
|
+
typing.List[AnnotationsCreateBulkResponseItem],
|
|
622
731
|
construct_type(
|
|
623
|
-
type_=
|
|
732
|
+
type_=typing.List[AnnotationsCreateBulkResponseItem], # type: ignore
|
|
624
733
|
object_=_response.json(),
|
|
625
734
|
),
|
|
626
735
|
)
|
|
@@ -629,9 +738,9 @@ class AsyncAnnotationsClient:
|
|
|
629
738
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
630
739
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
631
740
|
|
|
632
|
-
async def
|
|
741
|
+
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Annotation:
|
|
633
742
|
"""
|
|
634
|
-
|
|
743
|
+
Retrieve a specific annotation for a task using the annotation result ID.
|
|
635
744
|
|
|
636
745
|
Parameters
|
|
637
746
|
----------
|
|
@@ -642,7 +751,8 @@ class AsyncAnnotationsClient:
|
|
|
642
751
|
|
|
643
752
|
Returns
|
|
644
753
|
-------
|
|
645
|
-
|
|
754
|
+
Annotation
|
|
755
|
+
Retrieved annotation
|
|
646
756
|
|
|
647
757
|
Examples
|
|
648
758
|
--------
|
|
@@ -656,7 +766,7 @@ class AsyncAnnotationsClient:
|
|
|
656
766
|
|
|
657
767
|
|
|
658
768
|
async def main() -> None:
|
|
659
|
-
await client.annotations.
|
|
769
|
+
await client.annotations.get(
|
|
660
770
|
id=1,
|
|
661
771
|
)
|
|
662
772
|
|
|
@@ -665,69 +775,37 @@ class AsyncAnnotationsClient:
|
|
|
665
775
|
"""
|
|
666
776
|
_response = await self._client_wrapper.httpx_client.request(
|
|
667
777
|
f"api/annotations/{jsonable_encoder(id)}/",
|
|
668
|
-
method="
|
|
778
|
+
method="GET",
|
|
669
779
|
request_options=request_options,
|
|
670
780
|
)
|
|
671
781
|
try:
|
|
672
782
|
if 200 <= _response.status_code < 300:
|
|
673
|
-
return
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
task: typing.Optional[int] = OMIT,
|
|
685
|
-
project: typing.Optional[int] = OMIT,
|
|
686
|
-
completed_by: typing.Optional[int] = OMIT,
|
|
687
|
-
updated_by: typing.Optional[int] = OMIT,
|
|
688
|
-
was_cancelled: typing.Optional[bool] = OMIT,
|
|
689
|
-
ground_truth: typing.Optional[bool] = OMIT,
|
|
690
|
-
lead_time: typing.Optional[float] = OMIT,
|
|
691
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
692
|
-
) -> Annotation:
|
|
693
|
-
"""
|
|
694
|
-
Update existing attributes on an annotation.
|
|
695
|
-
|
|
696
|
-
Parameters
|
|
697
|
-
----------
|
|
698
|
-
id : int
|
|
699
|
-
|
|
700
|
-
result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
701
|
-
Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)
|
|
702
|
-
|
|
703
|
-
task : typing.Optional[int]
|
|
704
|
-
Corresponding task for this annotation
|
|
705
|
-
|
|
706
|
-
project : typing.Optional[int]
|
|
707
|
-
Project ID for this annotation
|
|
708
|
-
|
|
709
|
-
completed_by : typing.Optional[int]
|
|
710
|
-
User ID of the person who created this annotation
|
|
711
|
-
|
|
712
|
-
updated_by : typing.Optional[int]
|
|
713
|
-
Last user who updated this annotation
|
|
714
|
-
|
|
715
|
-
was_cancelled : typing.Optional[bool]
|
|
716
|
-
User skipped the task
|
|
783
|
+
return typing.cast(
|
|
784
|
+
Annotation,
|
|
785
|
+
construct_type(
|
|
786
|
+
type_=Annotation, # type: ignore
|
|
787
|
+
object_=_response.json(),
|
|
788
|
+
),
|
|
789
|
+
)
|
|
790
|
+
_response_json = _response.json()
|
|
791
|
+
except JSONDecodeError:
|
|
792
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
793
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
717
794
|
|
|
718
|
-
|
|
719
|
-
|
|
795
|
+
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
796
|
+
"""
|
|
797
|
+
Delete an annotation. This action can't be undone!
|
|
720
798
|
|
|
721
|
-
|
|
722
|
-
|
|
799
|
+
Parameters
|
|
800
|
+
----------
|
|
801
|
+
id : int
|
|
723
802
|
|
|
724
803
|
request_options : typing.Optional[RequestOptions]
|
|
725
804
|
Request-specific configuration.
|
|
726
805
|
|
|
727
806
|
Returns
|
|
728
807
|
-------
|
|
729
|
-
|
|
730
|
-
Updated annotation
|
|
808
|
+
None
|
|
731
809
|
|
|
732
810
|
Examples
|
|
733
811
|
--------
|
|
@@ -741,28 +819,8 @@ class AsyncAnnotationsClient:
|
|
|
741
819
|
|
|
742
820
|
|
|
743
821
|
async def main() -> None:
|
|
744
|
-
await client.annotations.
|
|
822
|
+
await client.annotations.delete(
|
|
745
823
|
id=1,
|
|
746
|
-
result=[
|
|
747
|
-
{
|
|
748
|
-
"original_width": 1920,
|
|
749
|
-
"original_height": 1080,
|
|
750
|
-
"image_rotation": 0,
|
|
751
|
-
"from_name": "bboxes",
|
|
752
|
-
"to_name": "image",
|
|
753
|
-
"type": "rectanglelabels",
|
|
754
|
-
"value": {
|
|
755
|
-
"x": 20,
|
|
756
|
-
"y": 30,
|
|
757
|
-
"width": 50,
|
|
758
|
-
"height": 60,
|
|
759
|
-
"rotation": 0,
|
|
760
|
-
"values": {"rectanglelabels": ["Person"]},
|
|
761
|
-
},
|
|
762
|
-
}
|
|
763
|
-
],
|
|
764
|
-
was_cancelled=False,
|
|
765
|
-
ground_truth=True,
|
|
766
824
|
)
|
|
767
825
|
|
|
768
826
|
|
|
@@ -770,133 +828,69 @@ class AsyncAnnotationsClient:
|
|
|
770
828
|
"""
|
|
771
829
|
_response = await self._client_wrapper.httpx_client.request(
|
|
772
830
|
f"api/annotations/{jsonable_encoder(id)}/",
|
|
773
|
-
method="
|
|
774
|
-
json={
|
|
775
|
-
"result": result,
|
|
776
|
-
"task": task,
|
|
777
|
-
"project": project,
|
|
778
|
-
"completed_by": completed_by,
|
|
779
|
-
"updated_by": updated_by,
|
|
780
|
-
"was_cancelled": was_cancelled,
|
|
781
|
-
"ground_truth": ground_truth,
|
|
782
|
-
"lead_time": lead_time,
|
|
783
|
-
},
|
|
784
|
-
headers={
|
|
785
|
-
"content-type": "application/json",
|
|
786
|
-
},
|
|
831
|
+
method="DELETE",
|
|
787
832
|
request_options=request_options,
|
|
788
|
-
omit=OMIT,
|
|
789
833
|
)
|
|
790
834
|
try:
|
|
791
835
|
if 200 <= _response.status_code < 300:
|
|
792
|
-
return
|
|
793
|
-
Annotation,
|
|
794
|
-
construct_type(
|
|
795
|
-
type_=Annotation, # type: ignore
|
|
796
|
-
object_=_response.json(),
|
|
797
|
-
),
|
|
798
|
-
)
|
|
836
|
+
return
|
|
799
837
|
_response_json = _response.json()
|
|
800
838
|
except JSONDecodeError:
|
|
801
839
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
802
840
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
803
841
|
|
|
804
|
-
async def
|
|
842
|
+
async def update(
|
|
805
843
|
self,
|
|
844
|
+
id: int,
|
|
806
845
|
*,
|
|
807
|
-
result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
808
846
|
completed_by: typing.Optional[int] = OMIT,
|
|
809
|
-
unique_id: typing.Optional[str] = OMIT,
|
|
810
|
-
tasks: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
811
|
-
selected_items: typing.Optional[SelectedItemsRequest] = OMIT,
|
|
812
|
-
was_cancelled: typing.Optional[bool] = OMIT,
|
|
813
847
|
ground_truth: typing.Optional[bool] = OMIT,
|
|
814
|
-
draft_created_at: typing.Optional[dt.datetime] = OMIT,
|
|
815
848
|
lead_time: typing.Optional[float] = OMIT,
|
|
816
|
-
import_id: typing.Optional[int] = OMIT,
|
|
817
|
-
last_action: typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction] = OMIT,
|
|
818
|
-
bulk_created: typing.Optional[bool] = OMIT,
|
|
819
|
-
task: typing.Optional[int] = OMIT,
|
|
820
849
|
project: typing.Optional[int] = OMIT,
|
|
850
|
+
result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
851
|
+
task: typing.Optional[int] = OMIT,
|
|
821
852
|
updated_by: typing.Optional[int] = OMIT,
|
|
822
|
-
|
|
823
|
-
parent_annotation: typing.Optional[int] = OMIT,
|
|
824
|
-
last_created_by: typing.Optional[int] = OMIT,
|
|
853
|
+
was_cancelled: typing.Optional[bool] = OMIT,
|
|
825
854
|
request_options: typing.Optional[RequestOptions] = None,
|
|
826
|
-
) ->
|
|
855
|
+
) -> Annotation:
|
|
827
856
|
"""
|
|
828
|
-
|
|
857
|
+
Update existing attributes on an annotation.
|
|
829
858
|
|
|
830
859
|
Parameters
|
|
831
860
|
----------
|
|
832
|
-
|
|
833
|
-
List of annotation results for the task
|
|
861
|
+
id : int
|
|
834
862
|
|
|
835
863
|
completed_by : typing.Optional[int]
|
|
836
|
-
|
|
837
|
-
unique_id : typing.Optional[str]
|
|
838
|
-
|
|
839
|
-
tasks : typing.Optional[typing.Sequence[int]]
|
|
840
|
-
|
|
841
|
-
selected_items : typing.Optional[SelectedItemsRequest]
|
|
842
|
-
|
|
843
|
-
was_cancelled : typing.Optional[bool]
|
|
844
|
-
User skipped the task
|
|
864
|
+
User ID of the person who created this annotation
|
|
845
865
|
|
|
846
866
|
ground_truth : typing.Optional[bool]
|
|
847
|
-
This annotation is a Ground Truth
|
|
848
|
-
|
|
849
|
-
draft_created_at : typing.Optional[dt.datetime]
|
|
850
|
-
Draft creation time
|
|
867
|
+
This annotation is a Ground Truth
|
|
851
868
|
|
|
852
869
|
lead_time : typing.Optional[float]
|
|
853
|
-
How much time it took to annotate the task
|
|
854
|
-
|
|
855
|
-
import_id : typing.Optional[int]
|
|
856
|
-
Original annotation ID that was at the import step or NULL if this annotation wasn't imported
|
|
857
|
-
|
|
858
|
-
last_action : typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction]
|
|
859
|
-
Action which was performed in the last annotation history item
|
|
870
|
+
How much time it took to annotate the task (in seconds)
|
|
860
871
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
* `imported` - Imported
|
|
864
|
-
* `submitted` - Submitted
|
|
865
|
-
* `updated` - Updated
|
|
866
|
-
* `skipped` - Skipped
|
|
867
|
-
* `accepted` - Accepted
|
|
868
|
-
* `rejected` - Rejected
|
|
869
|
-
* `fixed_and_accepted` - Fixed and accepted
|
|
870
|
-
* `deleted_review` - Deleted review
|
|
872
|
+
project : typing.Optional[int]
|
|
873
|
+
Project ID for this annotation
|
|
871
874
|
|
|
872
|
-
|
|
873
|
-
|
|
875
|
+
result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
876
|
+
Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)
|
|
874
877
|
|
|
875
878
|
task : typing.Optional[int]
|
|
876
879
|
Corresponding task for this annotation
|
|
877
880
|
|
|
878
|
-
project : typing.Optional[int]
|
|
879
|
-
Project ID for this annotation
|
|
880
|
-
|
|
881
881
|
updated_by : typing.Optional[int]
|
|
882
882
|
Last user who updated this annotation
|
|
883
883
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
parent_annotation : typing.Optional[int]
|
|
888
|
-
Points to the parent annotation from which this annotation was created
|
|
889
|
-
|
|
890
|
-
last_created_by : typing.Optional[int]
|
|
891
|
-
User who created the last annotation history item
|
|
884
|
+
was_cancelled : typing.Optional[bool]
|
|
885
|
+
User skipped the task
|
|
892
886
|
|
|
893
887
|
request_options : typing.Optional[RequestOptions]
|
|
894
888
|
Request-specific configuration.
|
|
895
889
|
|
|
896
890
|
Returns
|
|
897
891
|
-------
|
|
898
|
-
|
|
899
|
-
|
|
892
|
+
Annotation
|
|
893
|
+
Updated annotation
|
|
900
894
|
|
|
901
895
|
Examples
|
|
902
896
|
--------
|
|
@@ -910,39 +904,45 @@ class AsyncAnnotationsClient:
|
|
|
910
904
|
|
|
911
905
|
|
|
912
906
|
async def main() -> None:
|
|
913
|
-
await client.annotations.
|
|
907
|
+
await client.annotations.update(
|
|
908
|
+
id=1,
|
|
909
|
+
ground_truth=True,
|
|
910
|
+
result=[
|
|
911
|
+
{
|
|
912
|
+
"from_name": "bboxes",
|
|
913
|
+
"image_rotation": 0,
|
|
914
|
+
"original_height": 1080,
|
|
915
|
+
"original_width": 1920,
|
|
916
|
+
"to_name": "image",
|
|
917
|
+
"type": "rectanglelabels",
|
|
918
|
+
"value": {
|
|
919
|
+
"height": 60,
|
|
920
|
+
"rotation": 0,
|
|
921
|
+
"values": {"rectanglelabels": ["Person"]},
|
|
922
|
+
"width": 50,
|
|
923
|
+
"x": 20,
|
|
924
|
+
"y": 30,
|
|
925
|
+
},
|
|
926
|
+
}
|
|
927
|
+
],
|
|
928
|
+
was_cancelled=False,
|
|
929
|
+
)
|
|
914
930
|
|
|
915
931
|
|
|
916
932
|
asyncio.run(main())
|
|
917
933
|
"""
|
|
918
934
|
_response = await self._client_wrapper.httpx_client.request(
|
|
919
|
-
"api/annotations/
|
|
920
|
-
method="
|
|
935
|
+
f"api/annotations/{jsonable_encoder(id)}/",
|
|
936
|
+
method="PATCH",
|
|
921
937
|
json={
|
|
922
|
-
"result": result,
|
|
923
938
|
"completed_by": completed_by,
|
|
924
|
-
"unique_id": unique_id,
|
|
925
|
-
"tasks": tasks,
|
|
926
|
-
"selected_items": convert_and_respect_annotation_metadata(
|
|
927
|
-
object_=selected_items, annotation=SelectedItemsRequest, direction="write"
|
|
928
|
-
),
|
|
929
|
-
"was_cancelled": was_cancelled,
|
|
930
939
|
"ground_truth": ground_truth,
|
|
931
|
-
"draft_created_at": draft_created_at,
|
|
932
940
|
"lead_time": lead_time,
|
|
933
|
-
"import_id": import_id,
|
|
934
|
-
"last_action": convert_and_respect_annotation_metadata(
|
|
935
|
-
object_=last_action,
|
|
936
|
-
annotation=AnnotationBulkSerializerWithSelectedItemsRequestLastAction,
|
|
937
|
-
direction="write",
|
|
938
|
-
),
|
|
939
|
-
"bulk_created": bulk_created,
|
|
940
|
-
"task": task,
|
|
941
941
|
"project": project,
|
|
942
|
+
"result": result,
|
|
943
|
+
"task": task,
|
|
942
944
|
"updated_by": updated_by,
|
|
943
|
-
"
|
|
944
|
-
"parent_annotation": parent_annotation,
|
|
945
|
-
"last_created_by": last_created_by,
|
|
945
|
+
"was_cancelled": was_cancelled,
|
|
946
946
|
},
|
|
947
947
|
headers={
|
|
948
948
|
"content-type": "application/json",
|
|
@@ -953,9 +953,9 @@ class AsyncAnnotationsClient:
|
|
|
953
953
|
try:
|
|
954
954
|
if 200 <= _response.status_code < 300:
|
|
955
955
|
return typing.cast(
|
|
956
|
-
|
|
956
|
+
Annotation,
|
|
957
957
|
construct_type(
|
|
958
|
-
type_=
|
|
958
|
+
type_=Annotation, # type: ignore
|
|
959
959
|
object_=_response.json(),
|
|
960
960
|
),
|
|
961
961
|
)
|
|
@@ -1031,14 +1031,14 @@ class AsyncAnnotationsClient:
|
|
|
1031
1031
|
self,
|
|
1032
1032
|
id: int,
|
|
1033
1033
|
*,
|
|
1034
|
+
completed_by: typing.Optional[int] = OMIT,
|
|
1035
|
+
ground_truth: typing.Optional[bool] = OMIT,
|
|
1036
|
+
lead_time: typing.Optional[float] = OMIT,
|
|
1037
|
+
project: typing.Optional[int] = OMIT,
|
|
1034
1038
|
result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
|
|
1035
1039
|
task: typing.Optional[int] = OMIT,
|
|
1036
|
-
project: typing.Optional[int] = OMIT,
|
|
1037
|
-
completed_by: typing.Optional[int] = OMIT,
|
|
1038
1040
|
updated_by: typing.Optional[int] = OMIT,
|
|
1039
1041
|
was_cancelled: typing.Optional[bool] = OMIT,
|
|
1040
|
-
ground_truth: typing.Optional[bool] = OMIT,
|
|
1041
|
-
lead_time: typing.Optional[float] = OMIT,
|
|
1042
1042
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1043
1043
|
) -> Annotation:
|
|
1044
1044
|
"""
|
|
@@ -1064,17 +1064,23 @@ class AsyncAnnotationsClient:
|
|
|
1064
1064
|
id : int
|
|
1065
1065
|
Task ID
|
|
1066
1066
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1067
|
+
completed_by : typing.Optional[int]
|
|
1068
|
+
User ID of the person who created this annotation
|
|
1069
1069
|
|
|
1070
|
-
|
|
1071
|
-
|
|
1070
|
+
ground_truth : typing.Optional[bool]
|
|
1071
|
+
This annotation is a Ground Truth
|
|
1072
|
+
|
|
1073
|
+
lead_time : typing.Optional[float]
|
|
1074
|
+
How much time it took to annotate the task (in seconds)
|
|
1072
1075
|
|
|
1073
1076
|
project : typing.Optional[int]
|
|
1074
1077
|
Project ID for this annotation
|
|
1075
1078
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1079
|
+
result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
|
|
1080
|
+
Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)
|
|
1081
|
+
|
|
1082
|
+
task : typing.Optional[int]
|
|
1083
|
+
Corresponding task for this annotation
|
|
1078
1084
|
|
|
1079
1085
|
updated_by : typing.Optional[int]
|
|
1080
1086
|
Last user who updated this annotation
|
|
@@ -1082,12 +1088,6 @@ class AsyncAnnotationsClient:
|
|
|
1082
1088
|
was_cancelled : typing.Optional[bool]
|
|
1083
1089
|
User skipped the task
|
|
1084
1090
|
|
|
1085
|
-
ground_truth : typing.Optional[bool]
|
|
1086
|
-
This annotation is a Ground Truth
|
|
1087
|
-
|
|
1088
|
-
lead_time : typing.Optional[float]
|
|
1089
|
-
How much time it took to annotate the task (in seconds)
|
|
1090
|
-
|
|
1091
1091
|
request_options : typing.Optional[RequestOptions]
|
|
1092
1092
|
Request-specific configuration.
|
|
1093
1093
|
|
|
@@ -1110,26 +1110,26 @@ class AsyncAnnotationsClient:
|
|
|
1110
1110
|
async def main() -> None:
|
|
1111
1111
|
await client.annotations.create(
|
|
1112
1112
|
id=1,
|
|
1113
|
+
ground_truth=True,
|
|
1113
1114
|
result=[
|
|
1114
1115
|
{
|
|
1115
|
-
"original_width": 1920,
|
|
1116
|
-
"original_height": 1080,
|
|
1117
|
-
"image_rotation": 0,
|
|
1118
1116
|
"from_name": "bboxes",
|
|
1117
|
+
"image_rotation": 0,
|
|
1118
|
+
"original_height": 1080,
|
|
1119
|
+
"original_width": 1920,
|
|
1119
1120
|
"to_name": "image",
|
|
1120
1121
|
"type": "rectanglelabels",
|
|
1121
1122
|
"value": {
|
|
1122
|
-
"x": 20,
|
|
1123
|
-
"y": 30,
|
|
1124
|
-
"width": 50,
|
|
1125
1123
|
"height": 60,
|
|
1126
1124
|
"rotation": 0,
|
|
1127
1125
|
"values": {"rectanglelabels": ["Person"]},
|
|
1126
|
+
"width": 50,
|
|
1127
|
+
"x": 20,
|
|
1128
|
+
"y": 30,
|
|
1128
1129
|
},
|
|
1129
1130
|
}
|
|
1130
1131
|
],
|
|
1131
1132
|
was_cancelled=False,
|
|
1132
|
-
ground_truth=True,
|
|
1133
1133
|
)
|
|
1134
1134
|
|
|
1135
1135
|
|
|
@@ -1139,14 +1139,14 @@ class AsyncAnnotationsClient:
|
|
|
1139
1139
|
f"api/tasks/{jsonable_encoder(id)}/annotations/",
|
|
1140
1140
|
method="POST",
|
|
1141
1141
|
json={
|
|
1142
|
+
"completed_by": completed_by,
|
|
1143
|
+
"ground_truth": ground_truth,
|
|
1144
|
+
"lead_time": lead_time,
|
|
1145
|
+
"project": project,
|
|
1142
1146
|
"result": result,
|
|
1143
1147
|
"task": task,
|
|
1144
|
-
"project": project,
|
|
1145
|
-
"completed_by": completed_by,
|
|
1146
1148
|
"updated_by": updated_by,
|
|
1147
1149
|
"was_cancelled": was_cancelled,
|
|
1148
|
-
"ground_truth": ground_truth,
|
|
1149
|
-
"lead_time": lead_time,
|
|
1150
1150
|
},
|
|
1151
1151
|
headers={
|
|
1152
1152
|
"content-type": "application/json",
|