label-studio-sdk 1.0.3__py3-none-any.whl → 1.0.5__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 +10 -0
- label_studio_sdk/actions/client.py +8 -8
- label_studio_sdk/annotations/client.py +24 -24
- label_studio_sdk/base_client.py +3 -0
- label_studio_sdk/core/client_wrapper.py +1 -1
- label_studio_sdk/core/http_client.py +36 -8
- label_studio_sdk/core/request_options.py +2 -2
- label_studio_sdk/export_storage/__init__.py +2 -1
- label_studio_sdk/export_storage/azure/client.py +28 -28
- label_studio_sdk/export_storage/client.py +7 -4
- label_studio_sdk/export_storage/gcs/client.py +28 -28
- label_studio_sdk/export_storage/local/client.py +28 -28
- label_studio_sdk/export_storage/redis/client.py +28 -28
- label_studio_sdk/export_storage/s3/client.py +28 -28
- label_studio_sdk/export_storage/s3s/__init__.py +2 -0
- label_studio_sdk/export_storage/s3s/client.py +836 -0
- label_studio_sdk/files/client.py +24 -24
- label_studio_sdk/import_storage/__init__.py +2 -1
- label_studio_sdk/import_storage/azure/client.py +28 -28
- label_studio_sdk/import_storage/client.py +7 -4
- label_studio_sdk/import_storage/gcs/client.py +28 -28
- label_studio_sdk/import_storage/local/client.py +28 -28
- label_studio_sdk/import_storage/redis/client.py +28 -28
- label_studio_sdk/import_storage/s3/client.py +28 -28
- label_studio_sdk/import_storage/s3s/__init__.py +2 -0
- label_studio_sdk/import_storage/s3s/client.py +1054 -0
- label_studio_sdk/label_interface/base.py +2 -2
- label_studio_sdk/label_interface/control_tags.py +32 -18
- label_studio_sdk/label_interface/create.py +241 -0
- label_studio_sdk/label_interface/interface.py +68 -0
- label_studio_sdk/label_interface/object_tags.py +26 -10
- label_studio_sdk/label_interface/objects.py +5 -5
- label_studio_sdk/ml/client.py +36 -36
- label_studio_sdk/predictions/client.py +24 -24
- label_studio_sdk/projects/client.py +86 -56
- label_studio_sdk/projects/client_ext.py +16 -1
- label_studio_sdk/projects/exports/client.py +38 -38
- label_studio_sdk/tasks/client.py +70 -60
- label_studio_sdk/tasks/client_ext.py +4 -0
- label_studio_sdk/types/__init__.py +8 -0
- label_studio_sdk/types/s3s_export_storage.py +80 -0
- label_studio_sdk/types/s3s_import_storage.py +129 -0
- label_studio_sdk/types/s3s_import_storage_status.py +7 -0
- label_studio_sdk/types/workspace.py +77 -0
- label_studio_sdk/users/client.py +32 -32
- label_studio_sdk/views/client.py +24 -24
- label_studio_sdk/webhooks/client.py +24 -24
- label_studio_sdk/workspaces/__init__.py +6 -0
- label_studio_sdk/workspaces/client.py +569 -0
- label_studio_sdk/workspaces/members/__init__.py +5 -0
- label_studio_sdk/workspaces/members/client.py +297 -0
- label_studio_sdk/workspaces/members/types/__init__.py +6 -0
- label_studio_sdk/workspaces/members/types/members_create_response.py +32 -0
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +32 -0
- {label_studio_sdk-1.0.3.dist-info → label_studio_sdk-1.0.5.dist-info}/METADATA +13 -12
- {label_studio_sdk-1.0.3.dist-info → label_studio_sdk-1.0.5.dist-info}/RECORD +57 -41
- {label_studio_sdk-1.0.3.dist-info → label_studio_sdk-1.0.5.dist-info}/WHEEL +0 -0
label_studio_sdk/ml/client.py
CHANGED
|
@@ -56,9 +56,9 @@ class MlClient:
|
|
|
56
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
57
57
|
"api/ml/", method="GET", params={"project": project}, request_options=request_options
|
|
58
58
|
)
|
|
59
|
-
if 200 <= _response.status_code < 300:
|
|
60
|
-
return pydantic_v1.parse_obj_as(typing.List[MlBackend], _response.json()) # type: ignore
|
|
61
59
|
try:
|
|
60
|
+
if 200 <= _response.status_code < 300:
|
|
61
|
+
return pydantic_v1.parse_obj_as(typing.List[MlBackend], _response.json()) # type: ignore
|
|
62
62
|
_response_json = _response.json()
|
|
63
63
|
except JSONDecodeError:
|
|
64
64
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -153,9 +153,9 @@ class MlClient:
|
|
|
153
153
|
request_options=request_options,
|
|
154
154
|
omit=OMIT,
|
|
155
155
|
)
|
|
156
|
-
if 200 <= _response.status_code < 300:
|
|
157
|
-
return pydantic_v1.parse_obj_as(MlCreateResponse, _response.json()) # type: ignore
|
|
158
156
|
try:
|
|
157
|
+
if 200 <= _response.status_code < 300:
|
|
158
|
+
return pydantic_v1.parse_obj_as(MlCreateResponse, _response.json()) # type: ignore
|
|
159
159
|
_response_json = _response.json()
|
|
160
160
|
except JSONDecodeError:
|
|
161
161
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -194,9 +194,9 @@ class MlClient:
|
|
|
194
194
|
_response = self._client_wrapper.httpx_client.request(
|
|
195
195
|
f"api/ml/{jsonable_encoder(id)}", method="GET", request_options=request_options
|
|
196
196
|
)
|
|
197
|
-
if 200 <= _response.status_code < 300:
|
|
198
|
-
return pydantic_v1.parse_obj_as(MlBackend, _response.json()) # type: ignore
|
|
199
197
|
try:
|
|
198
|
+
if 200 <= _response.status_code < 300:
|
|
199
|
+
return pydantic_v1.parse_obj_as(MlBackend, _response.json()) # type: ignore
|
|
200
200
|
_response_json = _response.json()
|
|
201
201
|
except JSONDecodeError:
|
|
202
202
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -234,9 +234,9 @@ class MlClient:
|
|
|
234
234
|
_response = self._client_wrapper.httpx_client.request(
|
|
235
235
|
f"api/ml/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
|
|
236
236
|
)
|
|
237
|
-
if 200 <= _response.status_code < 300:
|
|
238
|
-
return
|
|
239
237
|
try:
|
|
238
|
+
if 200 <= _response.status_code < 300:
|
|
239
|
+
return
|
|
240
240
|
_response_json = _response.json()
|
|
241
241
|
except JSONDecodeError:
|
|
242
242
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -335,9 +335,9 @@ class MlClient:
|
|
|
335
335
|
request_options=request_options,
|
|
336
336
|
omit=OMIT,
|
|
337
337
|
)
|
|
338
|
-
if 200 <= _response.status_code < 300:
|
|
339
|
-
return pydantic_v1.parse_obj_as(MlUpdateResponse, _response.json()) # type: ignore
|
|
340
338
|
try:
|
|
339
|
+
if 200 <= _response.status_code < 300:
|
|
340
|
+
return pydantic_v1.parse_obj_as(MlUpdateResponse, _response.json()) # type: ignore
|
|
341
341
|
_response_json = _response.json()
|
|
342
342
|
except JSONDecodeError:
|
|
343
343
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -397,9 +397,9 @@ class MlClient:
|
|
|
397
397
|
request_options=request_options,
|
|
398
398
|
omit=OMIT,
|
|
399
399
|
)
|
|
400
|
-
if 200 <= _response.status_code < 300:
|
|
401
|
-
return
|
|
402
400
|
try:
|
|
401
|
+
if 200 <= _response.status_code < 300:
|
|
402
|
+
return
|
|
403
403
|
_response_json = _response.json()
|
|
404
404
|
except JSONDecodeError:
|
|
405
405
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -452,11 +452,11 @@ class MlClient:
|
|
|
452
452
|
request_options=request_options,
|
|
453
453
|
omit=OMIT,
|
|
454
454
|
)
|
|
455
|
-
if 200 <= _response.status_code < 300:
|
|
456
|
-
return
|
|
457
|
-
if _response.status_code == 500:
|
|
458
|
-
raise InternalServerError(pydantic_v1.parse_obj_as(str, _response.json())) # type: ignore
|
|
459
455
|
try:
|
|
456
|
+
if 200 <= _response.status_code < 300:
|
|
457
|
+
return
|
|
458
|
+
if _response.status_code == 500:
|
|
459
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(str, _response.json())) # type: ignore
|
|
460
460
|
_response_json = _response.json()
|
|
461
461
|
except JSONDecodeError:
|
|
462
462
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -491,9 +491,9 @@ class MlClient:
|
|
|
491
491
|
_response = self._client_wrapper.httpx_client.request(
|
|
492
492
|
f"api/ml/{jsonable_encoder(id)}/versions", method="GET", request_options=request_options
|
|
493
493
|
)
|
|
494
|
-
if 200 <= _response.status_code < 300:
|
|
495
|
-
return
|
|
496
494
|
try:
|
|
495
|
+
if 200 <= _response.status_code < 300:
|
|
496
|
+
return
|
|
497
497
|
_response_json = _response.json()
|
|
498
498
|
except JSONDecodeError:
|
|
499
499
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -537,9 +537,9 @@ class AsyncMlClient:
|
|
|
537
537
|
_response = await self._client_wrapper.httpx_client.request(
|
|
538
538
|
"api/ml/", method="GET", params={"project": project}, request_options=request_options
|
|
539
539
|
)
|
|
540
|
-
if 200 <= _response.status_code < 300:
|
|
541
|
-
return pydantic_v1.parse_obj_as(typing.List[MlBackend], _response.json()) # type: ignore
|
|
542
540
|
try:
|
|
541
|
+
if 200 <= _response.status_code < 300:
|
|
542
|
+
return pydantic_v1.parse_obj_as(typing.List[MlBackend], _response.json()) # type: ignore
|
|
543
543
|
_response_json = _response.json()
|
|
544
544
|
except JSONDecodeError:
|
|
545
545
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -634,9 +634,9 @@ class AsyncMlClient:
|
|
|
634
634
|
request_options=request_options,
|
|
635
635
|
omit=OMIT,
|
|
636
636
|
)
|
|
637
|
-
if 200 <= _response.status_code < 300:
|
|
638
|
-
return pydantic_v1.parse_obj_as(MlCreateResponse, _response.json()) # type: ignore
|
|
639
637
|
try:
|
|
638
|
+
if 200 <= _response.status_code < 300:
|
|
639
|
+
return pydantic_v1.parse_obj_as(MlCreateResponse, _response.json()) # type: ignore
|
|
640
640
|
_response_json = _response.json()
|
|
641
641
|
except JSONDecodeError:
|
|
642
642
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -675,9 +675,9 @@ class AsyncMlClient:
|
|
|
675
675
|
_response = await self._client_wrapper.httpx_client.request(
|
|
676
676
|
f"api/ml/{jsonable_encoder(id)}", method="GET", request_options=request_options
|
|
677
677
|
)
|
|
678
|
-
if 200 <= _response.status_code < 300:
|
|
679
|
-
return pydantic_v1.parse_obj_as(MlBackend, _response.json()) # type: ignore
|
|
680
678
|
try:
|
|
679
|
+
if 200 <= _response.status_code < 300:
|
|
680
|
+
return pydantic_v1.parse_obj_as(MlBackend, _response.json()) # type: ignore
|
|
681
681
|
_response_json = _response.json()
|
|
682
682
|
except JSONDecodeError:
|
|
683
683
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -715,9 +715,9 @@ class AsyncMlClient:
|
|
|
715
715
|
_response = await self._client_wrapper.httpx_client.request(
|
|
716
716
|
f"api/ml/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
|
|
717
717
|
)
|
|
718
|
-
if 200 <= _response.status_code < 300:
|
|
719
|
-
return
|
|
720
718
|
try:
|
|
719
|
+
if 200 <= _response.status_code < 300:
|
|
720
|
+
return
|
|
721
721
|
_response_json = _response.json()
|
|
722
722
|
except JSONDecodeError:
|
|
723
723
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -816,9 +816,9 @@ class AsyncMlClient:
|
|
|
816
816
|
request_options=request_options,
|
|
817
817
|
omit=OMIT,
|
|
818
818
|
)
|
|
819
|
-
if 200 <= _response.status_code < 300:
|
|
820
|
-
return pydantic_v1.parse_obj_as(MlUpdateResponse, _response.json()) # type: ignore
|
|
821
819
|
try:
|
|
820
|
+
if 200 <= _response.status_code < 300:
|
|
821
|
+
return pydantic_v1.parse_obj_as(MlUpdateResponse, _response.json()) # type: ignore
|
|
822
822
|
_response_json = _response.json()
|
|
823
823
|
except JSONDecodeError:
|
|
824
824
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -878,9 +878,9 @@ class AsyncMlClient:
|
|
|
878
878
|
request_options=request_options,
|
|
879
879
|
omit=OMIT,
|
|
880
880
|
)
|
|
881
|
-
if 200 <= _response.status_code < 300:
|
|
882
|
-
return
|
|
883
881
|
try:
|
|
882
|
+
if 200 <= _response.status_code < 300:
|
|
883
|
+
return
|
|
884
884
|
_response_json = _response.json()
|
|
885
885
|
except JSONDecodeError:
|
|
886
886
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -933,11 +933,11 @@ class AsyncMlClient:
|
|
|
933
933
|
request_options=request_options,
|
|
934
934
|
omit=OMIT,
|
|
935
935
|
)
|
|
936
|
-
if 200 <= _response.status_code < 300:
|
|
937
|
-
return
|
|
938
|
-
if _response.status_code == 500:
|
|
939
|
-
raise InternalServerError(pydantic_v1.parse_obj_as(str, _response.json())) # type: ignore
|
|
940
936
|
try:
|
|
937
|
+
if 200 <= _response.status_code < 300:
|
|
938
|
+
return
|
|
939
|
+
if _response.status_code == 500:
|
|
940
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(str, _response.json())) # type: ignore
|
|
941
941
|
_response_json = _response.json()
|
|
942
942
|
except JSONDecodeError:
|
|
943
943
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -972,9 +972,9 @@ class AsyncMlClient:
|
|
|
972
972
|
_response = await self._client_wrapper.httpx_client.request(
|
|
973
973
|
f"api/ml/{jsonable_encoder(id)}/versions", method="GET", request_options=request_options
|
|
974
974
|
)
|
|
975
|
-
if 200 <= _response.status_code < 300:
|
|
976
|
-
return
|
|
977
975
|
try:
|
|
976
|
+
if 200 <= _response.status_code < 300:
|
|
977
|
+
return
|
|
978
978
|
_response_json = _response.json()
|
|
979
979
|
except JSONDecodeError:
|
|
980
980
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -62,9 +62,9 @@ class PredictionsClient:
|
|
|
62
62
|
_response = self._client_wrapper.httpx_client.request(
|
|
63
63
|
"api/predictions/", method="GET", params={"task": task, "project": project}, request_options=request_options
|
|
64
64
|
)
|
|
65
|
-
if 200 <= _response.status_code < 300:
|
|
66
|
-
return pydantic_v1.parse_obj_as(typing.List[Prediction], _response.json()) # type: ignore
|
|
67
65
|
try:
|
|
66
|
+
if 200 <= _response.status_code < 300:
|
|
67
|
+
return pydantic_v1.parse_obj_as(typing.List[Prediction], _response.json()) # type: ignore
|
|
68
68
|
_response_json = _response.json()
|
|
69
69
|
except JSONDecodeError:
|
|
70
70
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -137,7 +137,7 @@ class PredictionsClient:
|
|
|
137
137
|
"width": 50,
|
|
138
138
|
"height": 60,
|
|
139
139
|
"rotation": 0,
|
|
140
|
-
"values": {"rectanglelabels":
|
|
140
|
+
"values": {"rectanglelabels": ["Person"]},
|
|
141
141
|
},
|
|
142
142
|
}
|
|
143
143
|
],
|
|
@@ -152,9 +152,9 @@ class PredictionsClient:
|
|
|
152
152
|
request_options=request_options,
|
|
153
153
|
omit=OMIT,
|
|
154
154
|
)
|
|
155
|
-
if 200 <= _response.status_code < 300:
|
|
156
|
-
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
157
155
|
try:
|
|
156
|
+
if 200 <= _response.status_code < 300:
|
|
157
|
+
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
158
158
|
_response_json = _response.json()
|
|
159
159
|
except JSONDecodeError:
|
|
160
160
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -193,9 +193,9 @@ class PredictionsClient:
|
|
|
193
193
|
_response = self._client_wrapper.httpx_client.request(
|
|
194
194
|
f"api/predictions/{jsonable_encoder(id)}/", method="GET", request_options=request_options
|
|
195
195
|
)
|
|
196
|
-
if 200 <= _response.status_code < 300:
|
|
197
|
-
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
198
196
|
try:
|
|
197
|
+
if 200 <= _response.status_code < 300:
|
|
198
|
+
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
199
199
|
_response_json = _response.json()
|
|
200
200
|
except JSONDecodeError:
|
|
201
201
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -231,9 +231,9 @@ class PredictionsClient:
|
|
|
231
231
|
_response = self._client_wrapper.httpx_client.request(
|
|
232
232
|
f"api/predictions/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
|
|
233
233
|
)
|
|
234
|
-
if 200 <= _response.status_code < 300:
|
|
235
|
-
return
|
|
236
234
|
try:
|
|
235
|
+
if 200 <= _response.status_code < 300:
|
|
236
|
+
return
|
|
237
237
|
_response_json = _response.json()
|
|
238
238
|
except JSONDecodeError:
|
|
239
239
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -302,7 +302,7 @@ class PredictionsClient:
|
|
|
302
302
|
"width": 50,
|
|
303
303
|
"height": 60,
|
|
304
304
|
"rotation": 0,
|
|
305
|
-
"values": {"rectanglelabels":
|
|
305
|
+
"values": {"rectanglelabels": ["Person"]},
|
|
306
306
|
},
|
|
307
307
|
}
|
|
308
308
|
],
|
|
@@ -317,9 +317,9 @@ class PredictionsClient:
|
|
|
317
317
|
request_options=request_options,
|
|
318
318
|
omit=OMIT,
|
|
319
319
|
)
|
|
320
|
-
if 200 <= _response.status_code < 300:
|
|
321
|
-
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
322
320
|
try:
|
|
321
|
+
if 200 <= _response.status_code < 300:
|
|
322
|
+
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
323
323
|
_response_json = _response.json()
|
|
324
324
|
except JSONDecodeError:
|
|
325
325
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -374,9 +374,9 @@ class AsyncPredictionsClient:
|
|
|
374
374
|
_response = await self._client_wrapper.httpx_client.request(
|
|
375
375
|
"api/predictions/", method="GET", params={"task": task, "project": project}, request_options=request_options
|
|
376
376
|
)
|
|
377
|
-
if 200 <= _response.status_code < 300:
|
|
378
|
-
return pydantic_v1.parse_obj_as(typing.List[Prediction], _response.json()) # type: ignore
|
|
379
377
|
try:
|
|
378
|
+
if 200 <= _response.status_code < 300:
|
|
379
|
+
return pydantic_v1.parse_obj_as(typing.List[Prediction], _response.json()) # type: ignore
|
|
380
380
|
_response_json = _response.json()
|
|
381
381
|
except JSONDecodeError:
|
|
382
382
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -449,7 +449,7 @@ class AsyncPredictionsClient:
|
|
|
449
449
|
"width": 50,
|
|
450
450
|
"height": 60,
|
|
451
451
|
"rotation": 0,
|
|
452
|
-
"values": {"rectanglelabels":
|
|
452
|
+
"values": {"rectanglelabels": ["Person"]},
|
|
453
453
|
},
|
|
454
454
|
}
|
|
455
455
|
],
|
|
@@ -464,9 +464,9 @@ class AsyncPredictionsClient:
|
|
|
464
464
|
request_options=request_options,
|
|
465
465
|
omit=OMIT,
|
|
466
466
|
)
|
|
467
|
-
if 200 <= _response.status_code < 300:
|
|
468
|
-
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
469
467
|
try:
|
|
468
|
+
if 200 <= _response.status_code < 300:
|
|
469
|
+
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
470
470
|
_response_json = _response.json()
|
|
471
471
|
except JSONDecodeError:
|
|
472
472
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -505,9 +505,9 @@ class AsyncPredictionsClient:
|
|
|
505
505
|
_response = await self._client_wrapper.httpx_client.request(
|
|
506
506
|
f"api/predictions/{jsonable_encoder(id)}/", method="GET", request_options=request_options
|
|
507
507
|
)
|
|
508
|
-
if 200 <= _response.status_code < 300:
|
|
509
|
-
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
510
508
|
try:
|
|
509
|
+
if 200 <= _response.status_code < 300:
|
|
510
|
+
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
511
511
|
_response_json = _response.json()
|
|
512
512
|
except JSONDecodeError:
|
|
513
513
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -543,9 +543,9 @@ class AsyncPredictionsClient:
|
|
|
543
543
|
_response = await self._client_wrapper.httpx_client.request(
|
|
544
544
|
f"api/predictions/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
|
|
545
545
|
)
|
|
546
|
-
if 200 <= _response.status_code < 300:
|
|
547
|
-
return
|
|
548
546
|
try:
|
|
547
|
+
if 200 <= _response.status_code < 300:
|
|
548
|
+
return
|
|
549
549
|
_response_json = _response.json()
|
|
550
550
|
except JSONDecodeError:
|
|
551
551
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -614,7 +614,7 @@ class AsyncPredictionsClient:
|
|
|
614
614
|
"width": 50,
|
|
615
615
|
"height": 60,
|
|
616
616
|
"rotation": 0,
|
|
617
|
-
"values": {"rectanglelabels":
|
|
617
|
+
"values": {"rectanglelabels": ["Person"]},
|
|
618
618
|
},
|
|
619
619
|
}
|
|
620
620
|
],
|
|
@@ -629,9 +629,9 @@ class AsyncPredictionsClient:
|
|
|
629
629
|
request_options=request_options,
|
|
630
630
|
omit=OMIT,
|
|
631
631
|
)
|
|
632
|
-
if 200 <= _response.status_code < 300:
|
|
633
|
-
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
634
632
|
try:
|
|
633
|
+
if 200 <= _response.status_code < 300:
|
|
634
|
+
return pydantic_v1.parse_obj_as(Prediction, _response.json()) # type: ignore
|
|
635
635
|
_response_json = _response.json()
|
|
636
636
|
except JSONDecodeError:
|
|
637
637
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -81,7 +81,12 @@ class ProjectsClient:
|
|
|
81
81
|
client = LabelStudio(
|
|
82
82
|
api_key="YOUR_API_KEY",
|
|
83
83
|
)
|
|
84
|
-
client.projects.list()
|
|
84
|
+
response = client.projects.list()
|
|
85
|
+
for item in response:
|
|
86
|
+
yield item
|
|
87
|
+
# alternatively, you can paginate page-by-page
|
|
88
|
+
for page in response.iter_pages():
|
|
89
|
+
yield page
|
|
85
90
|
"""
|
|
86
91
|
page = page or 1
|
|
87
92
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -90,20 +95,20 @@ class ProjectsClient:
|
|
|
90
95
|
params={"ordering": ordering, "ids": ids, "title": title, "page": page, "page_size": page_size},
|
|
91
96
|
request_options=request_options,
|
|
92
97
|
)
|
|
93
|
-
if 200 <= _response.status_code < 300:
|
|
94
|
-
_parsed_response = pydantic_v1.parse_obj_as(ProjectsListResponse, _response.json()) # type: ignore
|
|
95
|
-
_has_next = True
|
|
96
|
-
_get_next = lambda: self.list(
|
|
97
|
-
ordering=ordering,
|
|
98
|
-
ids=ids,
|
|
99
|
-
title=title,
|
|
100
|
-
page=page + 1,
|
|
101
|
-
page_size=page_size,
|
|
102
|
-
request_options=request_options,
|
|
103
|
-
)
|
|
104
|
-
_items = _parsed_response.results
|
|
105
|
-
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next)
|
|
106
98
|
try:
|
|
99
|
+
if 200 <= _response.status_code < 300:
|
|
100
|
+
_parsed_response = pydantic_v1.parse_obj_as(ProjectsListResponse, _response.json()) # type: ignore
|
|
101
|
+
_has_next = True
|
|
102
|
+
_get_next = lambda: self.list(
|
|
103
|
+
ordering=ordering,
|
|
104
|
+
ids=ids,
|
|
105
|
+
title=title,
|
|
106
|
+
page=page + 1,
|
|
107
|
+
page_size=page_size,
|
|
108
|
+
request_options=request_options,
|
|
109
|
+
)
|
|
110
|
+
_items = _parsed_response.results
|
|
111
|
+
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next)
|
|
107
112
|
_response_json = _response.json()
|
|
108
113
|
except JSONDecodeError:
|
|
109
114
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -125,6 +130,7 @@ class ProjectsClient:
|
|
|
125
130
|
maximum_annotations: typing.Optional[int] = OMIT,
|
|
126
131
|
color: typing.Optional[str] = OMIT,
|
|
127
132
|
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
133
|
+
workspace: typing.Optional[int] = OMIT,
|
|
128
134
|
request_options: typing.Optional[RequestOptions] = None,
|
|
129
135
|
) -> ProjectsCreateResponse:
|
|
130
136
|
"""
|
|
@@ -179,6 +185,9 @@ class ProjectsClient:
|
|
|
179
185
|
control_weights : typing.Optional[typing.Dict[str, typing.Any]]
|
|
180
186
|
Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
|
|
181
187
|
|
|
188
|
+
workspace : typing.Optional[int]
|
|
189
|
+
Workspace ID
|
|
190
|
+
|
|
182
191
|
request_options : typing.Optional[RequestOptions]
|
|
183
192
|
Request-specific configuration.
|
|
184
193
|
|
|
@@ -213,13 +222,14 @@ class ProjectsClient:
|
|
|
213
222
|
"maximum_annotations": maximum_annotations,
|
|
214
223
|
"color": color,
|
|
215
224
|
"control_weights": control_weights,
|
|
225
|
+
"workspace": workspace,
|
|
216
226
|
},
|
|
217
227
|
request_options=request_options,
|
|
218
228
|
omit=OMIT,
|
|
219
229
|
)
|
|
220
|
-
if 200 <= _response.status_code < 300:
|
|
221
|
-
return pydantic_v1.parse_obj_as(ProjectsCreateResponse, _response.json()) # type: ignore
|
|
222
230
|
try:
|
|
231
|
+
if 200 <= _response.status_code < 300:
|
|
232
|
+
return pydantic_v1.parse_obj_as(ProjectsCreateResponse, _response.json()) # type: ignore
|
|
223
233
|
_response_json = _response.json()
|
|
224
234
|
except JSONDecodeError:
|
|
225
235
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -256,9 +266,9 @@ class ProjectsClient:
|
|
|
256
266
|
_response = self._client_wrapper.httpx_client.request(
|
|
257
267
|
f"api/projects/{jsonable_encoder(id)}/", method="GET", request_options=request_options
|
|
258
268
|
)
|
|
259
|
-
if 200 <= _response.status_code < 300:
|
|
260
|
-
return pydantic_v1.parse_obj_as(Project, _response.json()) # type: ignore
|
|
261
269
|
try:
|
|
270
|
+
if 200 <= _response.status_code < 300:
|
|
271
|
+
return pydantic_v1.parse_obj_as(Project, _response.json()) # type: ignore
|
|
262
272
|
_response_json = _response.json()
|
|
263
273
|
except JSONDecodeError:
|
|
264
274
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -296,9 +306,9 @@ class ProjectsClient:
|
|
|
296
306
|
_response = self._client_wrapper.httpx_client.request(
|
|
297
307
|
f"api/projects/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
|
|
298
308
|
)
|
|
299
|
-
if 200 <= _response.status_code < 300:
|
|
300
|
-
return
|
|
301
309
|
try:
|
|
310
|
+
if 200 <= _response.status_code < 300:
|
|
311
|
+
return
|
|
302
312
|
_response_json = _response.json()
|
|
303
313
|
except JSONDecodeError:
|
|
304
314
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -321,6 +331,7 @@ class ProjectsClient:
|
|
|
321
331
|
maximum_annotations: typing.Optional[int] = OMIT,
|
|
322
332
|
color: typing.Optional[str] = OMIT,
|
|
323
333
|
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
334
|
+
workspace: typing.Optional[int] = OMIT,
|
|
324
335
|
request_options: typing.Optional[RequestOptions] = None,
|
|
325
336
|
) -> ProjectsUpdateResponse:
|
|
326
337
|
"""
|
|
@@ -382,6 +393,9 @@ class ProjectsClient:
|
|
|
382
393
|
control_weights : typing.Optional[typing.Dict[str, typing.Any]]
|
|
383
394
|
Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
|
|
384
395
|
|
|
396
|
+
workspace : typing.Optional[int]
|
|
397
|
+
Workspace ID
|
|
398
|
+
|
|
385
399
|
request_options : typing.Optional[RequestOptions]
|
|
386
400
|
Request-specific configuration.
|
|
387
401
|
|
|
@@ -418,13 +432,14 @@ class ProjectsClient:
|
|
|
418
432
|
"maximum_annotations": maximum_annotations,
|
|
419
433
|
"color": color,
|
|
420
434
|
"control_weights": control_weights,
|
|
435
|
+
"workspace": workspace,
|
|
421
436
|
},
|
|
422
437
|
request_options=request_options,
|
|
423
438
|
omit=OMIT,
|
|
424
439
|
)
|
|
425
|
-
if 200 <= _response.status_code < 300:
|
|
426
|
-
return pydantic_v1.parse_obj_as(ProjectsUpdateResponse, _response.json()) # type: ignore
|
|
427
440
|
try:
|
|
441
|
+
if 200 <= _response.status_code < 300:
|
|
442
|
+
return pydantic_v1.parse_obj_as(ProjectsUpdateResponse, _response.json()) # type: ignore
|
|
428
443
|
_response_json = _response.json()
|
|
429
444
|
except JSONDecodeError:
|
|
430
445
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -541,11 +556,11 @@ class ProjectsClient:
|
|
|
541
556
|
request_options=request_options,
|
|
542
557
|
omit=OMIT,
|
|
543
558
|
)
|
|
544
|
-
if 200 <= _response.status_code < 300:
|
|
545
|
-
return pydantic_v1.parse_obj_as(ProjectsImportTasksResponse, _response.json()) # type: ignore
|
|
546
|
-
if _response.status_code == 400:
|
|
547
|
-
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
|
548
559
|
try:
|
|
560
|
+
if 200 <= _response.status_code < 300:
|
|
561
|
+
return pydantic_v1.parse_obj_as(ProjectsImportTasksResponse, _response.json()) # type: ignore
|
|
562
|
+
if _response.status_code == 400:
|
|
563
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
|
549
564
|
_response_json = _response.json()
|
|
550
565
|
except JSONDecodeError:
|
|
551
566
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -596,9 +611,9 @@ class ProjectsClient:
|
|
|
596
611
|
request_options=request_options,
|
|
597
612
|
omit=OMIT,
|
|
598
613
|
)
|
|
599
|
-
if 200 <= _response.status_code < 300:
|
|
600
|
-
return pydantic_v1.parse_obj_as(ProjectLabelConfig, _response.json()) # type: ignore
|
|
601
614
|
try:
|
|
615
|
+
if 200 <= _response.status_code < 300:
|
|
616
|
+
return pydantic_v1.parse_obj_as(ProjectLabelConfig, _response.json()) # type: ignore
|
|
602
617
|
_response_json = _response.json()
|
|
603
618
|
except JSONDecodeError:
|
|
604
619
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -664,7 +679,12 @@ class AsyncProjectsClient:
|
|
|
664
679
|
client = AsyncLabelStudio(
|
|
665
680
|
api_key="YOUR_API_KEY",
|
|
666
681
|
)
|
|
667
|
-
await client.projects.list()
|
|
682
|
+
response = await client.projects.list()
|
|
683
|
+
async for item in response:
|
|
684
|
+
yield item
|
|
685
|
+
# alternatively, you can paginate page-by-page
|
|
686
|
+
async for page in response.iter_pages():
|
|
687
|
+
yield page
|
|
668
688
|
"""
|
|
669
689
|
page = page or 1
|
|
670
690
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -673,20 +693,20 @@ class AsyncProjectsClient:
|
|
|
673
693
|
params={"ordering": ordering, "ids": ids, "title": title, "page": page, "page_size": page_size},
|
|
674
694
|
request_options=request_options,
|
|
675
695
|
)
|
|
676
|
-
if 200 <= _response.status_code < 300:
|
|
677
|
-
_parsed_response = pydantic_v1.parse_obj_as(ProjectsListResponse, _response.json()) # type: ignore
|
|
678
|
-
_has_next = True
|
|
679
|
-
_get_next = lambda: self.list(
|
|
680
|
-
ordering=ordering,
|
|
681
|
-
ids=ids,
|
|
682
|
-
title=title,
|
|
683
|
-
page=page + 1,
|
|
684
|
-
page_size=page_size,
|
|
685
|
-
request_options=request_options,
|
|
686
|
-
)
|
|
687
|
-
_items = _parsed_response.results
|
|
688
|
-
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next)
|
|
689
696
|
try:
|
|
697
|
+
if 200 <= _response.status_code < 300:
|
|
698
|
+
_parsed_response = pydantic_v1.parse_obj_as(ProjectsListResponse, _response.json()) # type: ignore
|
|
699
|
+
_has_next = True
|
|
700
|
+
_get_next = lambda: self.list(
|
|
701
|
+
ordering=ordering,
|
|
702
|
+
ids=ids,
|
|
703
|
+
title=title,
|
|
704
|
+
page=page + 1,
|
|
705
|
+
page_size=page_size,
|
|
706
|
+
request_options=request_options,
|
|
707
|
+
)
|
|
708
|
+
_items = _parsed_response.results
|
|
709
|
+
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next)
|
|
690
710
|
_response_json = _response.json()
|
|
691
711
|
except JSONDecodeError:
|
|
692
712
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -708,6 +728,7 @@ class AsyncProjectsClient:
|
|
|
708
728
|
maximum_annotations: typing.Optional[int] = OMIT,
|
|
709
729
|
color: typing.Optional[str] = OMIT,
|
|
710
730
|
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
731
|
+
workspace: typing.Optional[int] = OMIT,
|
|
711
732
|
request_options: typing.Optional[RequestOptions] = None,
|
|
712
733
|
) -> ProjectsCreateResponse:
|
|
713
734
|
"""
|
|
@@ -762,6 +783,9 @@ class AsyncProjectsClient:
|
|
|
762
783
|
control_weights : typing.Optional[typing.Dict[str, typing.Any]]
|
|
763
784
|
Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
|
|
764
785
|
|
|
786
|
+
workspace : typing.Optional[int]
|
|
787
|
+
Workspace ID
|
|
788
|
+
|
|
765
789
|
request_options : typing.Optional[RequestOptions]
|
|
766
790
|
Request-specific configuration.
|
|
767
791
|
|
|
@@ -796,13 +820,14 @@ class AsyncProjectsClient:
|
|
|
796
820
|
"maximum_annotations": maximum_annotations,
|
|
797
821
|
"color": color,
|
|
798
822
|
"control_weights": control_weights,
|
|
823
|
+
"workspace": workspace,
|
|
799
824
|
},
|
|
800
825
|
request_options=request_options,
|
|
801
826
|
omit=OMIT,
|
|
802
827
|
)
|
|
803
|
-
if 200 <= _response.status_code < 300:
|
|
804
|
-
return pydantic_v1.parse_obj_as(ProjectsCreateResponse, _response.json()) # type: ignore
|
|
805
828
|
try:
|
|
829
|
+
if 200 <= _response.status_code < 300:
|
|
830
|
+
return pydantic_v1.parse_obj_as(ProjectsCreateResponse, _response.json()) # type: ignore
|
|
806
831
|
_response_json = _response.json()
|
|
807
832
|
except JSONDecodeError:
|
|
808
833
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -839,9 +864,9 @@ class AsyncProjectsClient:
|
|
|
839
864
|
_response = await self._client_wrapper.httpx_client.request(
|
|
840
865
|
f"api/projects/{jsonable_encoder(id)}/", method="GET", request_options=request_options
|
|
841
866
|
)
|
|
842
|
-
if 200 <= _response.status_code < 300:
|
|
843
|
-
return pydantic_v1.parse_obj_as(Project, _response.json()) # type: ignore
|
|
844
867
|
try:
|
|
868
|
+
if 200 <= _response.status_code < 300:
|
|
869
|
+
return pydantic_v1.parse_obj_as(Project, _response.json()) # type: ignore
|
|
845
870
|
_response_json = _response.json()
|
|
846
871
|
except JSONDecodeError:
|
|
847
872
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -879,9 +904,9 @@ class AsyncProjectsClient:
|
|
|
879
904
|
_response = await self._client_wrapper.httpx_client.request(
|
|
880
905
|
f"api/projects/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
|
|
881
906
|
)
|
|
882
|
-
if 200 <= _response.status_code < 300:
|
|
883
|
-
return
|
|
884
907
|
try:
|
|
908
|
+
if 200 <= _response.status_code < 300:
|
|
909
|
+
return
|
|
885
910
|
_response_json = _response.json()
|
|
886
911
|
except JSONDecodeError:
|
|
887
912
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -904,6 +929,7 @@ class AsyncProjectsClient:
|
|
|
904
929
|
maximum_annotations: typing.Optional[int] = OMIT,
|
|
905
930
|
color: typing.Optional[str] = OMIT,
|
|
906
931
|
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
932
|
+
workspace: typing.Optional[int] = OMIT,
|
|
907
933
|
request_options: typing.Optional[RequestOptions] = None,
|
|
908
934
|
) -> ProjectsUpdateResponse:
|
|
909
935
|
"""
|
|
@@ -965,6 +991,9 @@ class AsyncProjectsClient:
|
|
|
965
991
|
control_weights : typing.Optional[typing.Dict[str, typing.Any]]
|
|
966
992
|
Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
|
|
967
993
|
|
|
994
|
+
workspace : typing.Optional[int]
|
|
995
|
+
Workspace ID
|
|
996
|
+
|
|
968
997
|
request_options : typing.Optional[RequestOptions]
|
|
969
998
|
Request-specific configuration.
|
|
970
999
|
|
|
@@ -1001,13 +1030,14 @@ class AsyncProjectsClient:
|
|
|
1001
1030
|
"maximum_annotations": maximum_annotations,
|
|
1002
1031
|
"color": color,
|
|
1003
1032
|
"control_weights": control_weights,
|
|
1033
|
+
"workspace": workspace,
|
|
1004
1034
|
},
|
|
1005
1035
|
request_options=request_options,
|
|
1006
1036
|
omit=OMIT,
|
|
1007
1037
|
)
|
|
1008
|
-
if 200 <= _response.status_code < 300:
|
|
1009
|
-
return pydantic_v1.parse_obj_as(ProjectsUpdateResponse, _response.json()) # type: ignore
|
|
1010
1038
|
try:
|
|
1039
|
+
if 200 <= _response.status_code < 300:
|
|
1040
|
+
return pydantic_v1.parse_obj_as(ProjectsUpdateResponse, _response.json()) # type: ignore
|
|
1011
1041
|
_response_json = _response.json()
|
|
1012
1042
|
except JSONDecodeError:
|
|
1013
1043
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1124,11 +1154,11 @@ class AsyncProjectsClient:
|
|
|
1124
1154
|
request_options=request_options,
|
|
1125
1155
|
omit=OMIT,
|
|
1126
1156
|
)
|
|
1127
|
-
if 200 <= _response.status_code < 300:
|
|
1128
|
-
return pydantic_v1.parse_obj_as(ProjectsImportTasksResponse, _response.json()) # type: ignore
|
|
1129
|
-
if _response.status_code == 400:
|
|
1130
|
-
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
|
1131
1157
|
try:
|
|
1158
|
+
if 200 <= _response.status_code < 300:
|
|
1159
|
+
return pydantic_v1.parse_obj_as(ProjectsImportTasksResponse, _response.json()) # type: ignore
|
|
1160
|
+
if _response.status_code == 400:
|
|
1161
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
|
1132
1162
|
_response_json = _response.json()
|
|
1133
1163
|
except JSONDecodeError:
|
|
1134
1164
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1179,9 +1209,9 @@ class AsyncProjectsClient:
|
|
|
1179
1209
|
request_options=request_options,
|
|
1180
1210
|
omit=OMIT,
|
|
1181
1211
|
)
|
|
1182
|
-
if 200 <= _response.status_code < 300:
|
|
1183
|
-
return pydantic_v1.parse_obj_as(ProjectLabelConfig, _response.json()) # type: ignore
|
|
1184
1212
|
try:
|
|
1213
|
+
if 200 <= _response.status_code < 300:
|
|
1214
|
+
return pydantic_v1.parse_obj_as(ProjectLabelConfig, _response.json()) # type: ignore
|
|
1185
1215
|
_response_json = _response.json()
|
|
1186
1216
|
except JSONDecodeError:
|
|
1187
1217
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|