label-studio-sdk 1.0.20__py3-none-any.whl → 2.0.0__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 +325 -180
- label_studio_sdk/actions/__init__.py +4 -0
- label_studio_sdk/actions/client.py +46 -10
- label_studio_sdk/actions/types/__init__.py +4 -0
- label_studio_sdk/actions/types/actions_create_request_filters.py +2 -2
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +2 -2
- label_studio_sdk/actions/types/actions_create_request_id.py +7 -7
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +2 -2
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +2 -2
- label_studio_sdk/actions/types/actions_list_response_item.py +25 -0
- label_studio_sdk/actions/types/actions_list_response_item_dialog.py +22 -0
- label_studio_sdk/annotations/__init__.py +2 -2
- label_studio_sdk/annotations/client.py +379 -243
- label_studio_sdk/annotations/types/__init__.py +4 -2
- label_studio_sdk/annotations/types/annotation_bulk_serializer_with_selected_items_request_last_action.py +7 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +8 -5
- label_studio_sdk/base_client.py +28 -24
- label_studio_sdk/comments/client.py +378 -140
- label_studio_sdk/converter/README.md +207 -0
- label_studio_sdk/converter/imports/coco.py +132 -23
- label_studio_sdk/core/__init__.py +4 -0
- label_studio_sdk/core/unchecked_base_model.py +305 -0
- label_studio_sdk/environment.py +1 -1
- label_studio_sdk/errors/__init__.py +10 -1
- label_studio_sdk/errors/forbidden_error.py +9 -0
- label_studio_sdk/errors/method_not_allowed_error.py +9 -0
- label_studio_sdk/export_storage/__init__.py +1 -24
- label_studio_sdk/export_storage/azure/__init__.py +0 -3
- label_studio_sdk/export_storage/azure/client.py +231 -273
- label_studio_sdk/export_storage/client.py +5 -5
- label_studio_sdk/export_storage/gcs/__init__.py +0 -3
- label_studio_sdk/export_storage/gcs/client.py +231 -273
- label_studio_sdk/export_storage/local/__init__.py +0 -3
- label_studio_sdk/export_storage/local/client.py +211 -253
- label_studio_sdk/export_storage/redis/__init__.py +0 -3
- label_studio_sdk/export_storage/redis/client.py +239 -281
- label_studio_sdk/export_storage/s3/__init__.py +0 -3
- label_studio_sdk/export_storage/s3/client.py +254 -296
- label_studio_sdk/export_storage/s3s/client.py +694 -210
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +2 -2
- label_studio_sdk/files/client.py +52 -71
- label_studio_sdk/import_storage/__init__.py +1 -24
- label_studio_sdk/import_storage/azure/__init__.py +0 -3
- label_studio_sdk/import_storage/azure/client.py +249 -299
- label_studio_sdk/import_storage/client.py +5 -5
- label_studio_sdk/import_storage/gcs/__init__.py +0 -3
- label_studio_sdk/import_storage/gcs/client.py +249 -299
- label_studio_sdk/import_storage/local/__init__.py +0 -3
- label_studio_sdk/import_storage/local/client.py +211 -257
- label_studio_sdk/import_storage/redis/__init__.py +0 -3
- label_studio_sdk/import_storage/redis/client.py +239 -285
- label_studio_sdk/import_storage/s3/__init__.py +0 -3
- label_studio_sdk/import_storage/s3/client.py +274 -324
- label_studio_sdk/import_storage/s3s/client.py +728 -434
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +2 -2
- label_studio_sdk/jwt_settings/client.py +56 -58
- label_studio_sdk/label_interface/control_tags.py +48 -8
- label_studio_sdk/label_interface/interface.py +261 -56
- label_studio_sdk/ml/__init__.py +2 -16
- label_studio_sdk/ml/client.py +196 -179
- label_studio_sdk/ml/types/__init__.py +2 -12
- label_studio_sdk/ml/types/ml_list_model_versions_response.py +20 -0
- label_studio_sdk/model_providers/__init__.py +3 -0
- label_studio_sdk/model_providers/client.py +280 -228
- label_studio_sdk/model_providers/types/__init__.py +5 -0
- label_studio_sdk/{prompts/types/prompts_batch_predictions_response.py → model_providers/types/model_providers_list_model_provider_choices_response.py} +3 -3
- label_studio_sdk/organizations/__init__.py +5 -0
- label_studio_sdk/organizations/client.py +331 -0
- label_studio_sdk/organizations/members/__init__.py +2 -0
- label_studio_sdk/organizations/members/client.py +290 -0
- label_studio_sdk/predictions/client.py +29 -77
- label_studio_sdk/projects/__init__.py +18 -9
- label_studio_sdk/projects/client.py +905 -414
- label_studio_sdk/projects/exports/__init__.py +2 -2
- label_studio_sdk/projects/exports/client.py +336 -396
- label_studio_sdk/projects/exports/client_ext.py +30 -30
- label_studio_sdk/projects/exports/types/__init__.py +1 -2
- label_studio_sdk/projects/exports/types/exports_convert_response.py +5 -9
- label_studio_sdk/projects/pauses/client.py +114 -105
- label_studio_sdk/projects/stats/__init__.py +5 -0
- label_studio_sdk/projects/stats/client.py +175 -0
- label_studio_sdk/projects/stats/types/__init__.py +8 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response.py +44 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response_common_tasks.py +7 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response_iaa.py +5 -0
- label_studio_sdk/{types/base_task_file_upload.py → projects/stats/types/stats_iaa_response_std.py} +1 -1
- label_studio_sdk/projects/types/__init__.py +10 -6
- label_studio_sdk/projects/types/lse_project_create_request_sampling.py +7 -0
- label_studio_sdk/projects/types/lse_project_create_request_skip_queue.py +7 -0
- label_studio_sdk/projects/types/patched_lse_project_update_request_sampling.py +7 -0
- label_studio_sdk/projects/types/patched_lse_project_update_request_skip_queue.py +7 -0
- label_studio_sdk/{prompts/types/prompts_batch_failed_predictions_response.py → projects/types/projects_duplicate_response.py} +8 -5
- label_studio_sdk/projects/types/projects_import_tasks_response.py +2 -2
- label_studio_sdk/projects/types/projects_list_request_filter.py +1 -1
- label_studio_sdk/prompts/__init__.py +4 -10
- label_studio_sdk/prompts/client.py +511 -442
- label_studio_sdk/prompts/indicators/__init__.py +3 -0
- label_studio_sdk/prompts/indicators/client.py +47 -49
- label_studio_sdk/prompts/indicators/types/__init__.py +5 -0
- label_studio_sdk/{types/key_indicator_value.py → prompts/indicators/types/indicators_list_response_item.py} +3 -3
- label_studio_sdk/prompts/runs/client.py +113 -135
- label_studio_sdk/prompts/types/__init__.py +2 -12
- label_studio_sdk/prompts/types/prompts_compatible_projects_request_project_type.py +7 -0
- label_studio_sdk/prompts/versions/client.py +372 -312
- label_studio_sdk/tasks/__init__.py +2 -2
- label_studio_sdk/tasks/client.py +514 -213
- label_studio_sdk/tasks/types/__init__.py +1 -2
- label_studio_sdk/tokens/client.py +160 -152
- label_studio_sdk/tokens/client_ext.py +3 -3
- label_studio_sdk/types/__init__.py +258 -142
- label_studio_sdk/{webhooks/types/webhooks_update_request_actions_item.py → types/actions_enum.py} +4 -1
- label_studio_sdk/types/all_roles_project_list.py +197 -0
- label_studio_sdk/types/all_roles_project_list_sampling.py +7 -0
- label_studio_sdk/types/all_roles_project_list_skip_queue.py +7 -0
- label_studio_sdk/types/annotated_enum.py +5 -0
- label_studio_sdk/types/annotation.py +24 -10
- label_studio_sdk/types/annotation_last_action.py +3 -15
- label_studio_sdk/types/{annotations_dm_field.py → annotation_request.py} +21 -30
- label_studio_sdk/types/annotation_request_last_action.py +7 -0
- label_studio_sdk/types/assignment_settings.py +31 -0
- label_studio_sdk/types/assignment_settings_label_stream_task_distribution.py +7 -0
- label_studio_sdk/types/assignment_settings_request.py +32 -0
- label_studio_sdk/types/assignment_settings_request_label_stream_task_distribution.py +7 -0
- label_studio_sdk/types/{key_indicators_item_additional_kpis_item.py → associated_project.py} +9 -6
- label_studio_sdk/types/auth_method_enum.py +5 -0
- label_studio_sdk/types/azure_blob_export_storage.py +8 -12
- label_studio_sdk/types/azure_blob_import_storage.py +8 -12
- label_studio_sdk/types/{prompt_associated_projects_item_id.py → batch_failed_predictions.py} +4 -4
- label_studio_sdk/types/{access_token_response.py → batch_predictions.py} +6 -8
- label_studio_sdk/types/blank_enum.py +5 -0
- label_studio_sdk/types/{key_indicators_item_extra_kpis_item.py → blueprint_list.py} +12 -6
- label_studio_sdk/types/budget_reset_period_enum.py +5 -0
- label_studio_sdk/types/child_filter.py +44 -0
- label_studio_sdk/types/comment.py +39 -14
- label_studio_sdk/types/comment_request.py +32 -0
- label_studio_sdk/types/comment_serializer_with_expanded_user.py +53 -0
- label_studio_sdk/types/converted_format.py +5 -5
- label_studio_sdk/types/{api_token_response.py → converted_format_request.py} +8 -15
- label_studio_sdk/types/custom_scripts_editable_by_enum.py +5 -0
- label_studio_sdk/types/default_role_enum.py +5 -0
- label_studio_sdk/types/edition_enum.py +5 -0
- label_studio_sdk/types/export.py +7 -7
- label_studio_sdk/types/file_upload.py +5 -5
- label_studio_sdk/types/filter.py +9 -6
- label_studio_sdk/types/filter_group.py +3 -3
- label_studio_sdk/types/finished_enum.py +5 -0
- label_studio_sdk/types/gcs_export_storage.py +8 -12
- label_studio_sdk/types/gcs_import_storage.py +8 -12
- label_studio_sdk/types/{rotate_token_response.py → hotkeys.py} +5 -8
- label_studio_sdk/types/{base_task.py → import_api_request.py} +11 -34
- label_studio_sdk/types/inference_run_cost_estimate.py +2 -2
- label_studio_sdk/types/label_stream_task_distribution_enum.py +5 -0
- label_studio_sdk/types/{annotations_dm_field_last_action.py → last_action_enum.py} +1 -1
- label_studio_sdk/types/local_files_export_storage.py +8 -12
- label_studio_sdk/types/local_files_import_storage.py +8 -12
- label_studio_sdk/types/{annotation_filter_options.py → lse_annotation_filter_options.py} +12 -2
- label_studio_sdk/types/lse_annotation_filter_options_request.py +42 -0
- label_studio_sdk/types/lse_annotation_filter_options_request_reviewed.py +7 -0
- label_studio_sdk/types/lse_annotation_filter_options_reviewed.py +7 -0
- label_studio_sdk/types/{export_snapshot.py → lse_export_create.py} +11 -11
- label_studio_sdk/types/lse_fields.py +49 -0
- label_studio_sdk/types/lse_fields_onboarding_state.py +8 -0
- label_studio_sdk/types/lse_fields_trial_role.py +8 -0
- label_studio_sdk/types/lse_key_indicator_value.py +35 -0
- label_studio_sdk/types/lse_organization.py +57 -0
- label_studio_sdk/types/lse_organization_custom_scripts_editable_by.py +7 -0
- label_studio_sdk/types/lse_project_create.py +196 -0
- label_studio_sdk/types/lse_project_create_sampling.py +7 -0
- label_studio_sdk/types/lse_project_create_skip_queue.py +7 -0
- label_studio_sdk/types/lse_project_update.py +215 -0
- label_studio_sdk/types/lse_project_update_sampling.py +7 -0
- label_studio_sdk/types/lse_project_update_skip_queue.py +7 -0
- label_studio_sdk/types/lse_s3export_storage.py +134 -0
- label_studio_sdk/{import_storage/s3/types/s3create_response.py → types/lse_s3export_storage_request.py} +47 -21
- label_studio_sdk/{import_storage/s3/types/s3update_response.py → types/lse_s3import_storage.py} +60 -21
- label_studio_sdk/types/{s3s_import_storage.py → lse_s3import_storage_request.py} +32 -21
- label_studio_sdk/types/lse_task.py +117 -0
- label_studio_sdk/types/{data_manager_task_serializer_drafts_item.py → lse_task_drafts_item.py} +2 -2
- label_studio_sdk/types/lse_task_filter_options.py +63 -0
- label_studio_sdk/types/lse_task_filter_options_annotated.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_finished.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request.py +63 -0
- label_studio_sdk/types/lse_task_filter_options_request_annotated.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request_finished.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request_reviewed.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request_skipped.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_reviewed.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_skipped.py +7 -0
- label_studio_sdk/types/{data_manager_task_serializer_predictions_item.py → lse_task_predictions_item.py} +4 -5
- label_studio_sdk/types/lse_task_serializer_for_annotators.py +54 -0
- label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +22 -0
- label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +28 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +117 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +22 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +28 -0
- label_studio_sdk/types/lse_user.py +49 -0
- label_studio_sdk/types/{base_user.py → lse_user_api.py} +17 -6
- label_studio_sdk/types/lseapi_token_create.py +21 -0
- label_studio_sdk/types/lseapi_token_list.py +21 -0
- label_studio_sdk/types/lsejwt_settings.py +32 -0
- label_studio_sdk/types/maybe_expanded_comment.py +7 -0
- label_studio_sdk/types/ml_backend.py +16 -17
- label_studio_sdk/types/mode_enum.py +5 -0
- label_studio_sdk/types/model_interface.py +44 -0
- label_studio_sdk/types/model_interface_request.py +40 -0
- label_studio_sdk/types/model_interface_serializer_get.py +45 -0
- label_studio_sdk/types/model_provider_connection.py +48 -17
- label_studio_sdk/types/model_provider_connection_budget_reset_period.py +3 -1
- label_studio_sdk/types/model_provider_connection_request.py +71 -0
- label_studio_sdk/types/model_run.py +40 -0
- label_studio_sdk/types/{inference_run_status.py → model_run_status_enum.py} +1 -1
- label_studio_sdk/types/null_enum.py +3 -0
- label_studio_sdk/types/onboarding_state_enum.py +7 -0
- label_studio_sdk/types/organization_billing.py +20 -0
- label_studio_sdk/types/organization_id.py +28 -0
- label_studio_sdk/types/organization_invite.py +20 -0
- label_studio_sdk/types/organization_member.py +37 -0
- label_studio_sdk/types/organization_membership.py +24 -0
- label_studio_sdk/{projects/types/projects_list_response.py → types/paginated_all_roles_project_list_list.py} +5 -5
- label_studio_sdk/types/{jwt_settings_response.py → paginated_role_based_task_list.py} +11 -9
- label_studio_sdk/types/pause.py +55 -14
- label_studio_sdk/types/pause_request.py +41 -0
- label_studio_sdk/types/prediction.py +7 -11
- label_studio_sdk/types/prediction_request.py +56 -0
- label_studio_sdk/types/project.py +32 -39
- label_studio_sdk/types/project_import.py +12 -13
- label_studio_sdk/types/project_label_config.py +2 -2
- label_studio_sdk/types/project_label_config_request.py +22 -0
- label_studio_sdk/types/project_sampling.py +3 -3
- label_studio_sdk/types/project_skip_queue.py +3 -1
- label_studio_sdk/types/project_subset_enum.py +5 -0
- label_studio_sdk/types/{prompt_version_provider.py → provider_enum.py} +1 -1
- label_studio_sdk/types/reason_enum.py +7 -0
- label_studio_sdk/types/redis_export_storage.py +8 -12
- label_studio_sdk/types/redis_import_storage.py +8 -12
- label_studio_sdk/types/refined_prompt_response.py +5 -6
- label_studio_sdk/types/requeue_rejected_tasks_mode_enum.py +5 -0
- label_studio_sdk/types/review_criteria_enum.py +5 -0
- label_studio_sdk/types/review_settings.py +80 -0
- label_studio_sdk/types/review_settings_request.py +80 -0
- label_studio_sdk/types/review_settings_request_requeue_rejected_tasks_mode.py +8 -0
- label_studio_sdk/types/review_settings_request_review_criteria.py +7 -0
- label_studio_sdk/types/review_settings_requeue_rejected_tasks_mode.py +8 -0
- label_studio_sdk/types/review_settings_review_criteria.py +7 -0
- label_studio_sdk/types/reviewed_enum.py +5 -0
- label_studio_sdk/types/role_based_task.py +8 -0
- label_studio_sdk/types/s3export_storage.py +8 -12
- label_studio_sdk/types/s3import_storage.py +8 -12
- label_studio_sdk/types/sampling_enum.py +7 -0
- label_studio_sdk/types/scope_enum.py +5 -0
- label_studio_sdk/types/selected_items_request.py +23 -0
- label_studio_sdk/types/serialization_option.py +2 -6
- label_studio_sdk/types/serialization_option_request.py +22 -0
- label_studio_sdk/types/serialization_options.py +17 -5
- label_studio_sdk/types/serialization_options_request.py +47 -0
- label_studio_sdk/types/skill_name_enum.py +5 -0
- label_studio_sdk/types/skip_queue_enum.py +5 -0
- label_studio_sdk/types/skipped_enum.py +5 -0
- label_studio_sdk/types/state_enum.py +5 -0
- label_studio_sdk/types/status7bf_enum.py +5 -0
- label_studio_sdk/types/{azure_blob_import_storage_status.py → status_c5a_enum.py} +2 -2
- label_studio_sdk/types/third_party_model_version.py +65 -0
- label_studio_sdk/types/third_party_model_version_request.py +54 -0
- label_studio_sdk/types/token_refresh_response.py +19 -0
- label_studio_sdk/types/token_rotate_response.py +19 -0
- label_studio_sdk/types/trial_role_enum.py +16 -0
- label_studio_sdk/types/user_simple.py +8 -5
- label_studio_sdk/types/user_simple_request.py +28 -0
- label_studio_sdk/types/version_response.py +49 -0
- label_studio_sdk/types/view.py +8 -15
- label_studio_sdk/types/webhook.py +9 -13
- label_studio_sdk/types/webhook_serializer_for_update.py +15 -13
- label_studio_sdk/types/workspace.py +14 -34
- label_studio_sdk/types/workspace_member_create.py +27 -0
- label_studio_sdk/types/workspace_member_list.py +24 -0
- label_studio_sdk/users/client.py +604 -87
- label_studio_sdk/users/types/users_get_token_response.py +4 -11
- label_studio_sdk/users/types/users_reset_token_response.py +4 -11
- label_studio_sdk/versions/__init__.py +0 -3
- label_studio_sdk/versions/client.py +14 -14
- label_studio_sdk/views/client.py +227 -141
- label_studio_sdk/views/types/views_create_request_data.py +2 -2
- label_studio_sdk/views/types/views_create_request_data_filters.py +2 -2
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +2 -2
- label_studio_sdk/views/types/views_update_request_data.py +2 -2
- label_studio_sdk/views/types/views_update_request_data_filters.py +2 -2
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +2 -2
- label_studio_sdk/webhooks/__init__.py +36 -2
- label_studio_sdk/webhooks/client.py +173 -367
- label_studio_sdk/webhooks/types/__init__.py +34 -2
- label_studio_sdk/webhooks/types/webhooks_info_response.py +80 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +24 -0
- label_studio_sdk/workspaces/__init__.py +1 -2
- label_studio_sdk/workspaces/client.py +97 -117
- label_studio_sdk/workspaces/members/__init__.py +0 -3
- label_studio_sdk/workspaces/members/client.py +65 -81
- {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.0.dist-info}/METADATA +1 -1
- label_studio_sdk-2.0.0.dist-info/RECORD +424 -0
- {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.0.dist-info}/WHEEL +1 -1
- label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +0 -34
- label_studio_sdk/export_storage/azure/types/__init__.py +0 -6
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +0 -57
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +0 -57
- label_studio_sdk/export_storage/gcs/types/__init__.py +0 -6
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +0 -57
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +0 -57
- label_studio_sdk/export_storage/local/types/__init__.py +0 -6
- label_studio_sdk/export_storage/local/types/local_create_response.py +0 -47
- label_studio_sdk/export_storage/local/types/local_update_response.py +0 -47
- label_studio_sdk/export_storage/redis/types/__init__.py +0 -6
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +0 -62
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +0 -62
- label_studio_sdk/export_storage/s3/types/__init__.py +0 -6
- label_studio_sdk/export_storage/s3/types/s3create_response.py +0 -81
- label_studio_sdk/export_storage/s3/types/s3update_response.py +0 -81
- label_studio_sdk/import_storage/azure/types/__init__.py +0 -6
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +0 -72
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +0 -72
- label_studio_sdk/import_storage/gcs/types/__init__.py +0 -6
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +0 -72
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +0 -72
- label_studio_sdk/import_storage/local/types/__init__.py +0 -6
- label_studio_sdk/import_storage/local/types/local_create_response.py +0 -47
- label_studio_sdk/import_storage/local/types/local_update_response.py +0 -47
- label_studio_sdk/import_storage/redis/types/__init__.py +0 -6
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +0 -62
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +0 -62
- label_studio_sdk/import_storage/s3/types/__init__.py +0 -6
- label_studio_sdk/ml/types/ml_create_response.py +0 -68
- label_studio_sdk/ml/types/ml_create_response_auth_method.py +0 -5
- label_studio_sdk/ml/types/ml_update_response.py +0 -68
- label_studio_sdk/ml/types/ml_update_response_auth_method.py +0 -5
- label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +0 -44
- label_studio_sdk/projects/types/projects_create_response.py +0 -91
- label_studio_sdk/projects/types/projects_update_response.py +0 -96
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +0 -32
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +0 -59
- label_studio_sdk/tasks/types/tasks_list_response.py +0 -38
- label_studio_sdk/types/annotation_completed_by.py +0 -6
- label_studio_sdk/types/azure_blob_export_storage_status.py +0 -7
- label_studio_sdk/types/base_task_updated_by.py +0 -7
- label_studio_sdk/types/comment_created_by.py +0 -5
- label_studio_sdk/types/converted_format_status.py +0 -5
- label_studio_sdk/types/data_manager_task_serializer.py +0 -118
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +0 -5
- label_studio_sdk/types/data_manager_task_serializer_comment_authors_item.py +0 -5
- label_studio_sdk/types/data_manager_task_serializer_predictions_item_model_run.py +0 -5
- label_studio_sdk/types/export_format.py +0 -25
- label_studio_sdk/types/export_snapshot_status.py +0 -5
- label_studio_sdk/types/export_status.py +0 -5
- label_studio_sdk/types/gcs_export_storage_status.py +0 -7
- label_studio_sdk/types/gcs_import_storage_status.py +0 -7
- label_studio_sdk/types/inference_run.py +0 -34
- label_studio_sdk/types/inference_run_created_by.py +0 -5
- label_studio_sdk/types/inference_run_organization.py +0 -5
- label_studio_sdk/types/inference_run_project_subset.py +0 -5
- label_studio_sdk/types/key_indicators.py +0 -6
- label_studio_sdk/types/key_indicators_item.py +0 -41
- label_studio_sdk/types/local_files_export_storage_status.py +0 -7
- label_studio_sdk/types/local_files_import_storage_status.py +0 -7
- label_studio_sdk/types/ml_backend_auth_method.py +0 -5
- label_studio_sdk/types/ml_backend_state.py +0 -5
- label_studio_sdk/types/model_provider_connection_created_by.py +0 -5
- label_studio_sdk/types/model_provider_connection_organization.py +0 -5
- label_studio_sdk/types/model_provider_connection_provider.py +0 -7
- label_studio_sdk/types/model_provider_connection_scope.py +0 -5
- label_studio_sdk/types/pause_paused_by.py +0 -5
- label_studio_sdk/types/project_import_status.py +0 -5
- label_studio_sdk/types/prompt.py +0 -71
- label_studio_sdk/types/prompt_associated_projects_item.py +0 -6
- label_studio_sdk/types/prompt_created_by.py +0 -5
- label_studio_sdk/types/prompt_organization.py +0 -5
- label_studio_sdk/types/prompt_version.py +0 -32
- label_studio_sdk/types/prompt_version_created_by.py +0 -5
- label_studio_sdk/types/prompt_version_organization.py +0 -5
- label_studio_sdk/types/redis_export_storage_status.py +0 -7
- label_studio_sdk/types/redis_import_storage_status.py +0 -7
- label_studio_sdk/types/refined_prompt_response_refinement_status.py +0 -7
- label_studio_sdk/types/s3export_storage_status.py +0 -7
- label_studio_sdk/types/s3import_storage_status.py +0 -7
- label_studio_sdk/types/s3s_export_storage.py +0 -73
- label_studio_sdk/types/s3s_import_storage_status.py +0 -7
- label_studio_sdk/types/task.py +0 -156
- label_studio_sdk/types/task_annotators_item.py +0 -5
- label_studio_sdk/types/task_comment_authors_item.py +0 -5
- label_studio_sdk/types/task_filter_options.py +0 -39
- label_studio_sdk/types/webhook_actions_item.py +0 -21
- label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +0 -21
- label_studio_sdk/versions/types/__init__.py +0 -6
- label_studio_sdk/versions/types/versions_get_response.py +0 -73
- label_studio_sdk/versions/types/versions_get_response_edition.py +0 -5
- label_studio_sdk/workspaces/members/types/__init__.py +0 -6
- label_studio_sdk/workspaces/members/types/members_create_response.py +0 -22
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +0 -22
- label_studio_sdk-1.0.20.dist-info/RECORD +0 -374
- {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.0.dist-info}/LICENSE +0 -0
|
@@ -2,25 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
-
from .pauses.client import PausesClient
|
|
6
5
|
from .exports.client import ExportsClient
|
|
6
|
+
from .stats.client import StatsClient
|
|
7
|
+
from .pauses.client import PausesClient
|
|
7
8
|
from .types.projects_list_request_filter import ProjectsListRequestFilter
|
|
8
9
|
from ..core.request_options import RequestOptions
|
|
9
10
|
from ..core.pagination import SyncPager
|
|
10
|
-
from ..types.
|
|
11
|
-
from
|
|
12
|
-
from ..core.
|
|
11
|
+
from ..types.all_roles_project_list import AllRolesProjectList
|
|
12
|
+
from ..types.paginated_all_roles_project_list_list import PaginatedAllRolesProjectListList
|
|
13
|
+
from ..core.unchecked_base_model import construct_type
|
|
13
14
|
from json.decoder import JSONDecodeError
|
|
14
15
|
from ..core.api_error import ApiError
|
|
15
|
-
from
|
|
16
|
+
from ..types.user_simple_request import UserSimpleRequest
|
|
17
|
+
from .types.lse_project_create_request_sampling import LseProjectCreateRequestSampling
|
|
18
|
+
from .types.lse_project_create_request_skip_queue import LseProjectCreateRequestSkipQueue
|
|
19
|
+
import datetime as dt
|
|
20
|
+
from ..types.lse_project_create import LseProjectCreate
|
|
21
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
22
|
+
from ..types.project import Project
|
|
16
23
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
17
|
-
from .types.
|
|
24
|
+
from .types.patched_lse_project_update_request_sampling import PatchedLseProjectUpdateRequestSampling
|
|
25
|
+
from .types.patched_lse_project_update_request_skip_queue import PatchedLseProjectUpdateRequestSkipQueue
|
|
26
|
+
from ..types.review_settings_request import ReviewSettingsRequest
|
|
27
|
+
from ..types.assignment_settings_request import AssignmentSettingsRequest
|
|
28
|
+
from ..types.lse_project_update import LseProjectUpdate
|
|
29
|
+
from ..types.mode_enum import ModeEnum
|
|
30
|
+
from .types.projects_duplicate_response import ProjectsDuplicateResponse
|
|
31
|
+
from ..types.import_api_request import ImportApiRequest
|
|
18
32
|
from .types.projects_import_tasks_response import ProjectsImportTasksResponse
|
|
19
33
|
from ..errors.bad_request_error import BadRequestError
|
|
20
34
|
from ..types.project_label_config import ProjectLabelConfig
|
|
21
35
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
22
|
-
from .pauses.client import AsyncPausesClient
|
|
23
36
|
from .exports.client import AsyncExportsClient
|
|
37
|
+
from .stats.client import AsyncStatsClient
|
|
38
|
+
from .pauses.client import AsyncPausesClient
|
|
24
39
|
from ..core.pagination import AsyncPager
|
|
25
40
|
|
|
26
41
|
# this is used as the default value for optional parameters
|
|
@@ -30,44 +45,39 @@ OMIT = typing.cast(typing.Any, ...)
|
|
|
30
45
|
class ProjectsClient:
|
|
31
46
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
32
47
|
self._client_wrapper = client_wrapper
|
|
33
|
-
self.pauses = PausesClient(client_wrapper=self._client_wrapper)
|
|
34
48
|
self.exports = ExportsClient(client_wrapper=self._client_wrapper)
|
|
49
|
+
self.stats = StatsClient(client_wrapper=self._client_wrapper)
|
|
50
|
+
self.pauses = PausesClient(client_wrapper=self._client_wrapper)
|
|
35
51
|
|
|
36
52
|
def list(
|
|
37
53
|
self,
|
|
38
54
|
*,
|
|
39
|
-
|
|
55
|
+
filter: typing.Optional[ProjectsListRequestFilter] = None,
|
|
40
56
|
ids: typing.Optional[str] = None,
|
|
41
|
-
|
|
57
|
+
include: typing.Optional[str] = None,
|
|
58
|
+
ordering: typing.Optional[str] = None,
|
|
42
59
|
page: typing.Optional[int] = None,
|
|
43
60
|
page_size: typing.Optional[int] = None,
|
|
61
|
+
title: typing.Optional[str] = None,
|
|
44
62
|
workspaces: typing.Optional[int] = None,
|
|
45
|
-
include: typing.Optional[str] = None,
|
|
46
|
-
filter: typing.Optional[ProjectsListRequestFilter] = None,
|
|
47
63
|
request_options: typing.Optional[RequestOptions] = None,
|
|
48
|
-
) -> SyncPager[
|
|
64
|
+
) -> SyncPager[AllRolesProjectList]:
|
|
49
65
|
"""
|
|
50
|
-
|
|
51
|
-
Return a list of the projects within your organization.
|
|
52
|
-
|
|
53
|
-
To perform most tasks with the Label Studio API, you must specify the project ID, sometimes referred to as the `pk`. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using this API call.
|
|
54
|
-
|
|
55
|
-
To retrieve a list of your Label Studio projects, update the following command to match your own environment.
|
|
56
|
-
Replace the domain name, port, and authorization token, then run the following from the command line:
|
|
57
|
-
```bash
|
|
58
|
-
curl -X GET https://localhost:8080/api/projects/ -H 'Authorization: Token abc123'
|
|
59
|
-
```
|
|
66
|
+
Retrieve a list of projects.
|
|
60
67
|
|
|
61
68
|
Parameters
|
|
62
69
|
----------
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
filter : typing.Optional[ProjectsListRequestFilter]
|
|
71
|
+
Filter projects by pinned status. Use 'pinned_only' to return only pinned projects, 'exclude_pinned' to return only non-pinned projects, or 'all' to return all projects.
|
|
65
72
|
|
|
66
73
|
ids : typing.Optional[str]
|
|
67
74
|
ids
|
|
68
75
|
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
include : typing.Optional[str]
|
|
77
|
+
Comma-separated list of count fields to include in the response to optimize performance. Available fields: task_number, finished_task_number, total_predictions_number, total_annotations_number, num_tasks_with_annotations, useful_annotation_number, ground_truth_number, skipped_annotations_number. If not specified, all count fields are included.
|
|
78
|
+
|
|
79
|
+
ordering : typing.Optional[str]
|
|
80
|
+
Which field to use when ordering the results.
|
|
71
81
|
|
|
72
82
|
page : typing.Optional[int]
|
|
73
83
|
A page number within the paginated result set.
|
|
@@ -75,21 +85,18 @@ class ProjectsClient:
|
|
|
75
85
|
page_size : typing.Optional[int]
|
|
76
86
|
Number of results to return per page.
|
|
77
87
|
|
|
88
|
+
title : typing.Optional[str]
|
|
89
|
+
title
|
|
90
|
+
|
|
78
91
|
workspaces : typing.Optional[int]
|
|
79
92
|
workspaces
|
|
80
93
|
|
|
81
|
-
include : typing.Optional[str]
|
|
82
|
-
Comma-separated list of count fields to include in the response to optimize performance. Available fields: task_number, finished_task_number, total_predictions_number, total_annotations_number, num_tasks_with_annotations, useful_annotation_number, ground_truth_number, skipped_annotations_number. If not specified, all count fields are included.
|
|
83
|
-
|
|
84
|
-
filter : typing.Optional[ProjectsListRequestFilter]
|
|
85
|
-
Filter projects by pinned status. Use 'pinned_only' to return only pinned projects, 'exclude_pinned' to return only non-pinned projects, or 'all' to return all projects.
|
|
86
|
-
|
|
87
94
|
request_options : typing.Optional[RequestOptions]
|
|
88
95
|
Request-specific configuration.
|
|
89
96
|
|
|
90
97
|
Returns
|
|
91
98
|
-------
|
|
92
|
-
SyncPager[
|
|
99
|
+
SyncPager[AllRolesProjectList]
|
|
93
100
|
|
|
94
101
|
|
|
95
102
|
Examples
|
|
@@ -99,9 +106,7 @@ class ProjectsClient:
|
|
|
99
106
|
client = LabelStudio(
|
|
100
107
|
api_key="YOUR_API_KEY",
|
|
101
108
|
)
|
|
102
|
-
response = client.projects.list(
|
|
103
|
-
include="task_number,total_annotations_number,num_tasks_with_annotations",
|
|
104
|
-
)
|
|
109
|
+
response = client.projects.list()
|
|
105
110
|
for item in response:
|
|
106
111
|
yield item
|
|
107
112
|
# alternatively, you can paginate page-by-page
|
|
@@ -113,36 +118,36 @@ class ProjectsClient:
|
|
|
113
118
|
"api/projects/",
|
|
114
119
|
method="GET",
|
|
115
120
|
params={
|
|
116
|
-
"
|
|
121
|
+
"filter": filter,
|
|
117
122
|
"ids": ids,
|
|
118
|
-
"
|
|
123
|
+
"include": include,
|
|
124
|
+
"ordering": ordering,
|
|
119
125
|
"page": page,
|
|
120
126
|
"page_size": page_size,
|
|
127
|
+
"title": title,
|
|
121
128
|
"workspaces": workspaces,
|
|
122
|
-
"include": include,
|
|
123
|
-
"filter": filter,
|
|
124
129
|
},
|
|
125
130
|
request_options=request_options,
|
|
126
131
|
)
|
|
127
132
|
try:
|
|
128
133
|
if 200 <= _response.status_code < 300:
|
|
129
134
|
_parsed_response = typing.cast(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
type_=
|
|
135
|
+
PaginatedAllRolesProjectListList,
|
|
136
|
+
construct_type(
|
|
137
|
+
type_=PaginatedAllRolesProjectListList, # type: ignore
|
|
133
138
|
object_=_response.json(),
|
|
134
139
|
),
|
|
135
140
|
)
|
|
136
141
|
_has_next = True
|
|
137
142
|
_get_next = lambda: self.list(
|
|
138
|
-
|
|
143
|
+
filter=filter,
|
|
139
144
|
ids=ids,
|
|
140
|
-
|
|
145
|
+
include=include,
|
|
146
|
+
ordering=ordering,
|
|
141
147
|
page=page + 1,
|
|
142
148
|
page_size=page_size,
|
|
149
|
+
title=title,
|
|
143
150
|
workspaces=workspaces,
|
|
144
|
-
include=include,
|
|
145
|
-
filter=filter,
|
|
146
151
|
request_options=request_options,
|
|
147
152
|
)
|
|
148
153
|
_items = _parsed_response.results
|
|
@@ -163,80 +168,118 @@ class ProjectsClient:
|
|
|
163
168
|
show_skip_button: typing.Optional[bool] = OMIT,
|
|
164
169
|
enable_empty_annotation: typing.Optional[bool] = OMIT,
|
|
165
170
|
show_annotation_history: typing.Optional[bool] = OMIT,
|
|
166
|
-
|
|
167
|
-
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
168
|
-
maximum_annotations: typing.Optional[int] = OMIT,
|
|
171
|
+
organization: typing.Optional[int] = OMIT,
|
|
169
172
|
color: typing.Optional[str] = OMIT,
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
maximum_annotations: typing.Optional[int] = OMIT,
|
|
174
|
+
is_published: typing.Optional[bool] = OMIT,
|
|
172
175
|
model_version: typing.Optional[str] = OMIT,
|
|
176
|
+
is_draft: typing.Optional[bool] = OMIT,
|
|
177
|
+
created_by: typing.Optional[UserSimpleRequest] = OMIT,
|
|
178
|
+
min_annotations_to_start_training: typing.Optional[int] = OMIT,
|
|
179
|
+
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
180
|
+
sampling: typing.Optional[LseProjectCreateRequestSampling] = OMIT,
|
|
181
|
+
show_ground_truth_first: typing.Optional[bool] = OMIT,
|
|
182
|
+
show_overlap_first: typing.Optional[bool] = OMIT,
|
|
183
|
+
overlap_cohort_percentage: typing.Optional[int] = OMIT,
|
|
184
|
+
task_data_login: typing.Optional[str] = OMIT,
|
|
185
|
+
task_data_password: typing.Optional[str] = OMIT,
|
|
186
|
+
control_weights: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
187
|
+
evaluate_predictions_automatically: typing.Optional[bool] = OMIT,
|
|
188
|
+
skip_queue: typing.Optional[LseProjectCreateRequestSkipQueue] = OMIT,
|
|
189
|
+
reveal_preannotations_interactively: typing.Optional[bool] = OMIT,
|
|
190
|
+
pinned_at: typing.Optional[dt.datetime] = OMIT,
|
|
191
|
+
workspace: typing.Optional[int] = OMIT,
|
|
173
192
|
request_options: typing.Optional[RequestOptions] = None,
|
|
174
|
-
) ->
|
|
193
|
+
) -> LseProjectCreate:
|
|
175
194
|
"""
|
|
176
|
-
|
|
177
|
-
Create a project and set up the labeling interface. For more information about setting up projects, see the following:
|
|
178
|
-
* [Create and configure projects](https://labelstud.io/guide/setup_project)
|
|
179
|
-
* [Configure labeling interface](https://labelstud.io/guide/setup)
|
|
180
|
-
* [Project settings](https://labelstud.io/guide/project_settings)
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
curl -H Content-Type:application/json -H 'Authorization: Token abc123' -X POST 'https://localhost:8080/api/projects' --data '{"label_config": "<View>[...]</View>"}'
|
|
184
|
-
```
|
|
195
|
+
Create a project for a specific organization.
|
|
185
196
|
|
|
186
197
|
Parameters
|
|
187
198
|
----------
|
|
188
199
|
title : typing.Optional[str]
|
|
189
|
-
Project
|
|
200
|
+
Project name. Must be between 3 and 50 characters long.
|
|
190
201
|
|
|
191
202
|
description : typing.Optional[str]
|
|
192
203
|
Project description
|
|
193
204
|
|
|
194
205
|
label_config : typing.Optional[str]
|
|
195
|
-
Label config in XML format
|
|
206
|
+
Label config in XML format. See more about it in documentation
|
|
196
207
|
|
|
197
208
|
expert_instruction : typing.Optional[str]
|
|
198
|
-
Labeling instructions
|
|
209
|
+
Labeling instructions in HTML format
|
|
199
210
|
|
|
200
211
|
show_instruction : typing.Optional[bool]
|
|
201
|
-
Show
|
|
212
|
+
Show instructions to the annotator before they start
|
|
202
213
|
|
|
203
214
|
show_skip_button : typing.Optional[bool]
|
|
204
|
-
Show skip button
|
|
215
|
+
Show a skip button in interface and allow annotators to skip the task
|
|
205
216
|
|
|
206
217
|
enable_empty_annotation : typing.Optional[bool]
|
|
207
|
-
Allow empty annotations
|
|
218
|
+
Allow annotators to submit empty annotations
|
|
208
219
|
|
|
209
220
|
show_annotation_history : typing.Optional[bool]
|
|
210
|
-
Show annotation history
|
|
221
|
+
Show annotation history to annotator
|
|
211
222
|
|
|
212
|
-
|
|
213
|
-
Reveal preannotations interactively. If set to True, predictions will be shown to the user only after selecting the area of interest
|
|
223
|
+
organization : typing.Optional[int]
|
|
214
224
|
|
|
215
|
-
|
|
216
|
-
Show predictions to annotators
|
|
225
|
+
color : typing.Optional[str]
|
|
217
226
|
|
|
218
227
|
maximum_annotations : typing.Optional[int]
|
|
219
|
-
Maximum annotations per task
|
|
228
|
+
Maximum number of annotations for one task. If the number of annotations per task is equal or greater to this value, the task is completed (is_labeled=True)
|
|
220
229
|
|
|
221
|
-
|
|
222
|
-
|
|
230
|
+
is_published : typing.Optional[bool]
|
|
231
|
+
Whether or not the project is published to annotators
|
|
223
232
|
|
|
224
|
-
|
|
225
|
-
|
|
233
|
+
model_version : typing.Optional[str]
|
|
234
|
+
Machine learning model version
|
|
226
235
|
|
|
236
|
+
is_draft : typing.Optional[bool]
|
|
237
|
+
Whether or not the project is in the middle of being created
|
|
227
238
|
|
|
228
|
-
|
|
229
|
-
|
|
239
|
+
created_by : typing.Optional[UserSimpleRequest]
|
|
240
|
+
Project owner
|
|
230
241
|
|
|
231
|
-
|
|
232
|
-
|
|
242
|
+
min_annotations_to_start_training : typing.Optional[int]
|
|
243
|
+
Minimum number of completed tasks after which model training is started
|
|
244
|
+
|
|
245
|
+
show_collab_predictions : typing.Optional[bool]
|
|
246
|
+
If set, the annotator can view model predictions
|
|
247
|
+
|
|
248
|
+
sampling : typing.Optional[LseProjectCreateRequestSampling]
|
|
249
|
+
|
|
250
|
+
show_ground_truth_first : typing.Optional[bool]
|
|
251
|
+
|
|
252
|
+
show_overlap_first : typing.Optional[bool]
|
|
253
|
+
|
|
254
|
+
overlap_cohort_percentage : typing.Optional[int]
|
|
255
|
+
|
|
256
|
+
task_data_login : typing.Optional[str]
|
|
257
|
+
Task data credentials: login
|
|
258
|
+
|
|
259
|
+
task_data_password : typing.Optional[str]
|
|
260
|
+
Task data credentials: password
|
|
261
|
+
|
|
262
|
+
control_weights : typing.Optional[typing.Optional[typing.Any]]
|
|
263
|
+
|
|
264
|
+
evaluate_predictions_automatically : typing.Optional[bool]
|
|
265
|
+
Retrieve and display predictions when loading a task
|
|
266
|
+
|
|
267
|
+
skip_queue : typing.Optional[LseProjectCreateRequestSkipQueue]
|
|
268
|
+
|
|
269
|
+
reveal_preannotations_interactively : typing.Optional[bool]
|
|
270
|
+
Reveal pre-annotations interactively
|
|
271
|
+
|
|
272
|
+
pinned_at : typing.Optional[dt.datetime]
|
|
273
|
+
Pinned date and time
|
|
274
|
+
|
|
275
|
+
workspace : typing.Optional[int]
|
|
233
276
|
|
|
234
277
|
request_options : typing.Optional[RequestOptions]
|
|
235
278
|
Request-specific configuration.
|
|
236
279
|
|
|
237
280
|
Returns
|
|
238
281
|
-------
|
|
239
|
-
|
|
282
|
+
LseProjectCreate
|
|
240
283
|
|
|
241
284
|
|
|
242
285
|
Examples
|
|
@@ -260,13 +303,33 @@ class ProjectsClient:
|
|
|
260
303
|
"show_skip_button": show_skip_button,
|
|
261
304
|
"enable_empty_annotation": enable_empty_annotation,
|
|
262
305
|
"show_annotation_history": show_annotation_history,
|
|
263
|
-
"
|
|
264
|
-
"show_collab_predictions": show_collab_predictions,
|
|
265
|
-
"maximum_annotations": maximum_annotations,
|
|
306
|
+
"organization": organization,
|
|
266
307
|
"color": color,
|
|
308
|
+
"maximum_annotations": maximum_annotations,
|
|
309
|
+
"is_published": is_published,
|
|
310
|
+
"model_version": model_version,
|
|
311
|
+
"is_draft": is_draft,
|
|
312
|
+
"created_by": convert_and_respect_annotation_metadata(
|
|
313
|
+
object_=created_by, annotation=UserSimpleRequest, direction="write"
|
|
314
|
+
),
|
|
315
|
+
"min_annotations_to_start_training": min_annotations_to_start_training,
|
|
316
|
+
"show_collab_predictions": show_collab_predictions,
|
|
317
|
+
"sampling": convert_and_respect_annotation_metadata(
|
|
318
|
+
object_=sampling, annotation=LseProjectCreateRequestSampling, direction="write"
|
|
319
|
+
),
|
|
320
|
+
"show_ground_truth_first": show_ground_truth_first,
|
|
321
|
+
"show_overlap_first": show_overlap_first,
|
|
322
|
+
"overlap_cohort_percentage": overlap_cohort_percentage,
|
|
323
|
+
"task_data_login": task_data_login,
|
|
324
|
+
"task_data_password": task_data_password,
|
|
267
325
|
"control_weights": control_weights,
|
|
326
|
+
"evaluate_predictions_automatically": evaluate_predictions_automatically,
|
|
327
|
+
"skip_queue": convert_and_respect_annotation_metadata(
|
|
328
|
+
object_=skip_queue, annotation=LseProjectCreateRequestSkipQueue, direction="write"
|
|
329
|
+
),
|
|
330
|
+
"reveal_preannotations_interactively": reveal_preannotations_interactively,
|
|
331
|
+
"pinned_at": pinned_at,
|
|
268
332
|
"workspace": workspace,
|
|
269
|
-
"model_version": model_version,
|
|
270
333
|
},
|
|
271
334
|
headers={
|
|
272
335
|
"content-type": "application/json",
|
|
@@ -277,9 +340,9 @@ class ProjectsClient:
|
|
|
277
340
|
try:
|
|
278
341
|
if 200 <= _response.status_code < 300:
|
|
279
342
|
return typing.cast(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
type_=
|
|
343
|
+
LseProjectCreate,
|
|
344
|
+
construct_type(
|
|
345
|
+
type_=LseProjectCreate, # type: ignore
|
|
283
346
|
object_=_response.json(),
|
|
284
347
|
),
|
|
285
348
|
)
|
|
@@ -290,12 +353,11 @@ class ProjectsClient:
|
|
|
290
353
|
|
|
291
354
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Project:
|
|
292
355
|
"""
|
|
293
|
-
Retrieve information about a
|
|
356
|
+
Retrieve information about a project by project ID.
|
|
294
357
|
|
|
295
358
|
Parameters
|
|
296
359
|
----------
|
|
297
360
|
id : int
|
|
298
|
-
A unique integer value identifying this project.
|
|
299
361
|
|
|
300
362
|
request_options : typing.Optional[RequestOptions]
|
|
301
363
|
Request-specific configuration.
|
|
@@ -325,7 +387,7 @@ class ProjectsClient:
|
|
|
325
387
|
if 200 <= _response.status_code < 300:
|
|
326
388
|
return typing.cast(
|
|
327
389
|
Project,
|
|
328
|
-
|
|
390
|
+
construct_type(
|
|
329
391
|
type_=Project, # type: ignore
|
|
330
392
|
object_=_response.json(),
|
|
331
393
|
),
|
|
@@ -337,15 +399,11 @@ class ProjectsClient:
|
|
|
337
399
|
|
|
338
400
|
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
339
401
|
"""
|
|
340
|
-
|
|
341
|
-
Delete a project by specified project ID. Deleting a project permanently removes all tasks, annotations, and project data from Label Studio.
|
|
342
|
-
|
|
343
|
-
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](list).
|
|
402
|
+
Delete a project by specified project ID.
|
|
344
403
|
|
|
345
404
|
Parameters
|
|
346
405
|
----------
|
|
347
406
|
id : int
|
|
348
|
-
A unique integer value identifying this project.
|
|
349
407
|
|
|
350
408
|
request_options : typing.Optional[RequestOptions]
|
|
351
409
|
Request-specific configuration.
|
|
@@ -390,87 +448,154 @@ class ProjectsClient:
|
|
|
390
448
|
show_skip_button: typing.Optional[bool] = OMIT,
|
|
391
449
|
enable_empty_annotation: typing.Optional[bool] = OMIT,
|
|
392
450
|
show_annotation_history: typing.Optional[bool] = OMIT,
|
|
393
|
-
|
|
394
|
-
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
395
|
-
maximum_annotations: typing.Optional[int] = OMIT,
|
|
451
|
+
organization: typing.Optional[int] = OMIT,
|
|
396
452
|
color: typing.Optional[str] = OMIT,
|
|
397
|
-
|
|
398
|
-
|
|
453
|
+
maximum_annotations: typing.Optional[int] = OMIT,
|
|
454
|
+
is_published: typing.Optional[bool] = OMIT,
|
|
399
455
|
model_version: typing.Optional[str] = OMIT,
|
|
456
|
+
is_draft: typing.Optional[bool] = OMIT,
|
|
457
|
+
created_by: typing.Optional[UserSimpleRequest] = OMIT,
|
|
458
|
+
min_annotations_to_start_training: typing.Optional[int] = OMIT,
|
|
459
|
+
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
460
|
+
sampling: typing.Optional[PatchedLseProjectUpdateRequestSampling] = OMIT,
|
|
461
|
+
show_ground_truth_first: typing.Optional[bool] = OMIT,
|
|
462
|
+
show_overlap_first: typing.Optional[bool] = OMIT,
|
|
463
|
+
overlap_cohort_percentage: typing.Optional[int] = OMIT,
|
|
464
|
+
task_data_login: typing.Optional[str] = OMIT,
|
|
465
|
+
task_data_password: typing.Optional[str] = OMIT,
|
|
466
|
+
control_weights: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
467
|
+
evaluate_predictions_automatically: typing.Optional[bool] = OMIT,
|
|
468
|
+
skip_queue: typing.Optional[PatchedLseProjectUpdateRequestSkipQueue] = OMIT,
|
|
469
|
+
reveal_preannotations_interactively: typing.Optional[bool] = OMIT,
|
|
470
|
+
pinned_at: typing.Optional[dt.datetime] = OMIT,
|
|
471
|
+
workspace: typing.Optional[int] = OMIT,
|
|
472
|
+
review_settings: typing.Optional[ReviewSettingsRequest] = OMIT,
|
|
473
|
+
assignment_settings: typing.Optional[AssignmentSettingsRequest] = OMIT,
|
|
474
|
+
custom_script: typing.Optional[str] = OMIT,
|
|
475
|
+
comment_classification_config: typing.Optional[str] = OMIT,
|
|
476
|
+
require_comment_on_skip: typing.Optional[bool] = OMIT,
|
|
477
|
+
custom_task_lock_ttl: typing.Optional[int] = OMIT,
|
|
478
|
+
annotation_limit_count: typing.Optional[int] = OMIT,
|
|
479
|
+
annotation_limit_percent: typing.Optional[str] = OMIT,
|
|
480
|
+
pause_on_failed_annotator_evaluation: typing.Optional[bool] = OMIT,
|
|
481
|
+
annotator_evaluation_minimum_score: typing.Optional[str] = OMIT,
|
|
482
|
+
annotator_evaluation_minimum_tasks: typing.Optional[int] = OMIT,
|
|
400
483
|
request_options: typing.Optional[RequestOptions] = None,
|
|
401
|
-
) ->
|
|
484
|
+
) -> LseProjectUpdate:
|
|
402
485
|
"""
|
|
403
|
-
|
|
404
|
-
Update the project settings for a specific project. For more information, see the following:
|
|
405
|
-
* [Create and configure projects](https://labelstud.io/guide/setup_project)
|
|
406
|
-
* [Configure labeling interface](https://labelstud.io/guide/setup)
|
|
407
|
-
* [Project settings](https://labelstud.io/guide/project_settings)
|
|
408
|
-
|
|
409
|
-
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](list).
|
|
410
|
-
|
|
411
|
-
<Warning>
|
|
412
|
-
If you are modifying the labeling config for project that has in-progress work, note the following:
|
|
413
|
-
* You cannot remove labels or change the type of labeling being performed unless you delete any existing annotations that are using those labels.
|
|
414
|
-
* If you make changes to the labeling configuration, any tabs that you might have created in the Data Manager are removed.
|
|
415
|
-
</Warning>
|
|
486
|
+
Update the details of a specific project.
|
|
416
487
|
|
|
417
488
|
Parameters
|
|
418
489
|
----------
|
|
419
490
|
id : int
|
|
420
|
-
A unique integer value identifying this project.
|
|
421
491
|
|
|
422
492
|
title : typing.Optional[str]
|
|
423
|
-
Project
|
|
493
|
+
Project name. Must be between 3 and 50 characters long.
|
|
424
494
|
|
|
425
495
|
description : typing.Optional[str]
|
|
426
496
|
Project description
|
|
427
497
|
|
|
428
498
|
label_config : typing.Optional[str]
|
|
429
|
-
Label config in XML format
|
|
499
|
+
Label config in XML format. See more about it in documentation
|
|
430
500
|
|
|
431
501
|
expert_instruction : typing.Optional[str]
|
|
432
|
-
Labeling instructions
|
|
502
|
+
Labeling instructions in HTML format
|
|
433
503
|
|
|
434
504
|
show_instruction : typing.Optional[bool]
|
|
435
|
-
Show
|
|
505
|
+
Show instructions to the annotator before they start
|
|
436
506
|
|
|
437
507
|
show_skip_button : typing.Optional[bool]
|
|
438
|
-
Show skip button
|
|
508
|
+
Show a skip button in interface and allow annotators to skip the task
|
|
439
509
|
|
|
440
510
|
enable_empty_annotation : typing.Optional[bool]
|
|
441
|
-
Allow empty annotations
|
|
511
|
+
Allow annotators to submit empty annotations
|
|
442
512
|
|
|
443
513
|
show_annotation_history : typing.Optional[bool]
|
|
444
|
-
Show annotation history
|
|
514
|
+
Show annotation history to annotator
|
|
445
515
|
|
|
446
|
-
|
|
447
|
-
Reveal preannotations interactively. If set to True, predictions will be shown to the user only after selecting the area of interest
|
|
516
|
+
organization : typing.Optional[int]
|
|
448
517
|
|
|
449
|
-
|
|
450
|
-
Show predictions to annotators
|
|
518
|
+
color : typing.Optional[str]
|
|
451
519
|
|
|
452
520
|
maximum_annotations : typing.Optional[int]
|
|
453
|
-
Maximum annotations per task
|
|
521
|
+
Maximum number of annotations for one task. If the number of annotations per task is equal or greater to this value, the task is completed (is_labeled=True)
|
|
454
522
|
|
|
455
|
-
|
|
456
|
-
|
|
523
|
+
is_published : typing.Optional[bool]
|
|
524
|
+
Whether or not the project is published to annotators
|
|
525
|
+
|
|
526
|
+
model_version : typing.Optional[str]
|
|
527
|
+
Machine learning model version
|
|
528
|
+
|
|
529
|
+
is_draft : typing.Optional[bool]
|
|
530
|
+
Whether or not the project is in the middle of being created
|
|
531
|
+
|
|
532
|
+
created_by : typing.Optional[UserSimpleRequest]
|
|
533
|
+
Project owner
|
|
534
|
+
|
|
535
|
+
min_annotations_to_start_training : typing.Optional[int]
|
|
536
|
+
Minimum number of completed tasks after which model training is started
|
|
537
|
+
|
|
538
|
+
show_collab_predictions : typing.Optional[bool]
|
|
539
|
+
If set, the annotator can view model predictions
|
|
540
|
+
|
|
541
|
+
sampling : typing.Optional[PatchedLseProjectUpdateRequestSampling]
|
|
542
|
+
|
|
543
|
+
show_ground_truth_first : typing.Optional[bool]
|
|
544
|
+
|
|
545
|
+
show_overlap_first : typing.Optional[bool]
|
|
546
|
+
|
|
547
|
+
overlap_cohort_percentage : typing.Optional[int]
|
|
548
|
+
|
|
549
|
+
task_data_login : typing.Optional[str]
|
|
550
|
+
Task data credentials: login
|
|
551
|
+
|
|
552
|
+
task_data_password : typing.Optional[str]
|
|
553
|
+
Task data credentials: password
|
|
554
|
+
|
|
555
|
+
control_weights : typing.Optional[typing.Optional[typing.Any]]
|
|
457
556
|
|
|
458
|
-
|
|
459
|
-
|
|
557
|
+
evaluate_predictions_automatically : typing.Optional[bool]
|
|
558
|
+
Retrieve and display predictions when loading a task
|
|
460
559
|
|
|
560
|
+
skip_queue : typing.Optional[PatchedLseProjectUpdateRequestSkipQueue]
|
|
561
|
+
|
|
562
|
+
reveal_preannotations_interactively : typing.Optional[bool]
|
|
563
|
+
Reveal pre-annotations interactively
|
|
564
|
+
|
|
565
|
+
pinned_at : typing.Optional[dt.datetime]
|
|
566
|
+
Pinned date and time
|
|
461
567
|
|
|
462
568
|
workspace : typing.Optional[int]
|
|
463
|
-
Workspace ID
|
|
464
569
|
|
|
465
|
-
|
|
466
|
-
|
|
570
|
+
review_settings : typing.Optional[ReviewSettingsRequest]
|
|
571
|
+
|
|
572
|
+
assignment_settings : typing.Optional[AssignmentSettingsRequest]
|
|
573
|
+
|
|
574
|
+
custom_script : typing.Optional[str]
|
|
575
|
+
|
|
576
|
+
comment_classification_config : typing.Optional[str]
|
|
577
|
+
|
|
578
|
+
require_comment_on_skip : typing.Optional[bool]
|
|
579
|
+
|
|
580
|
+
custom_task_lock_ttl : typing.Optional[int]
|
|
581
|
+
TTL in seconds for task reservations, on new and existing tasks
|
|
582
|
+
|
|
583
|
+
annotation_limit_count : typing.Optional[int]
|
|
584
|
+
|
|
585
|
+
annotation_limit_percent : typing.Optional[str]
|
|
586
|
+
|
|
587
|
+
pause_on_failed_annotator_evaluation : typing.Optional[bool]
|
|
588
|
+
|
|
589
|
+
annotator_evaluation_minimum_score : typing.Optional[str]
|
|
590
|
+
|
|
591
|
+
annotator_evaluation_minimum_tasks : typing.Optional[int]
|
|
467
592
|
|
|
468
593
|
request_options : typing.Optional[RequestOptions]
|
|
469
594
|
Request-specific configuration.
|
|
470
595
|
|
|
471
596
|
Returns
|
|
472
597
|
-------
|
|
473
|
-
|
|
598
|
+
LseProjectUpdate
|
|
474
599
|
|
|
475
600
|
|
|
476
601
|
Examples
|
|
@@ -496,13 +621,48 @@ class ProjectsClient:
|
|
|
496
621
|
"show_skip_button": show_skip_button,
|
|
497
622
|
"enable_empty_annotation": enable_empty_annotation,
|
|
498
623
|
"show_annotation_history": show_annotation_history,
|
|
499
|
-
"
|
|
500
|
-
"show_collab_predictions": show_collab_predictions,
|
|
501
|
-
"maximum_annotations": maximum_annotations,
|
|
624
|
+
"organization": organization,
|
|
502
625
|
"color": color,
|
|
626
|
+
"maximum_annotations": maximum_annotations,
|
|
627
|
+
"is_published": is_published,
|
|
628
|
+
"model_version": model_version,
|
|
629
|
+
"is_draft": is_draft,
|
|
630
|
+
"created_by": convert_and_respect_annotation_metadata(
|
|
631
|
+
object_=created_by, annotation=UserSimpleRequest, direction="write"
|
|
632
|
+
),
|
|
633
|
+
"min_annotations_to_start_training": min_annotations_to_start_training,
|
|
634
|
+
"show_collab_predictions": show_collab_predictions,
|
|
635
|
+
"sampling": convert_and_respect_annotation_metadata(
|
|
636
|
+
object_=sampling, annotation=PatchedLseProjectUpdateRequestSampling, direction="write"
|
|
637
|
+
),
|
|
638
|
+
"show_ground_truth_first": show_ground_truth_first,
|
|
639
|
+
"show_overlap_first": show_overlap_first,
|
|
640
|
+
"overlap_cohort_percentage": overlap_cohort_percentage,
|
|
641
|
+
"task_data_login": task_data_login,
|
|
642
|
+
"task_data_password": task_data_password,
|
|
503
643
|
"control_weights": control_weights,
|
|
644
|
+
"evaluate_predictions_automatically": evaluate_predictions_automatically,
|
|
645
|
+
"skip_queue": convert_and_respect_annotation_metadata(
|
|
646
|
+
object_=skip_queue, annotation=PatchedLseProjectUpdateRequestSkipQueue, direction="write"
|
|
647
|
+
),
|
|
648
|
+
"reveal_preannotations_interactively": reveal_preannotations_interactively,
|
|
649
|
+
"pinned_at": pinned_at,
|
|
504
650
|
"workspace": workspace,
|
|
505
|
-
"
|
|
651
|
+
"review_settings": convert_and_respect_annotation_metadata(
|
|
652
|
+
object_=review_settings, annotation=ReviewSettingsRequest, direction="write"
|
|
653
|
+
),
|
|
654
|
+
"assignment_settings": convert_and_respect_annotation_metadata(
|
|
655
|
+
object_=assignment_settings, annotation=AssignmentSettingsRequest, direction="write"
|
|
656
|
+
),
|
|
657
|
+
"custom_script": custom_script,
|
|
658
|
+
"comment_classification_config": comment_classification_config,
|
|
659
|
+
"require_comment_on_skip": require_comment_on_skip,
|
|
660
|
+
"custom_task_lock_ttl": custom_task_lock_ttl,
|
|
661
|
+
"annotation_limit_count": annotation_limit_count,
|
|
662
|
+
"annotation_limit_percent": annotation_limit_percent,
|
|
663
|
+
"pause_on_failed_annotator_evaluation": pause_on_failed_annotator_evaluation,
|
|
664
|
+
"annotator_evaluation_minimum_score": annotator_evaluation_minimum_score,
|
|
665
|
+
"annotator_evaluation_minimum_tasks": annotator_evaluation_minimum_tasks,
|
|
506
666
|
},
|
|
507
667
|
headers={
|
|
508
668
|
"content-type": "application/json",
|
|
@@ -513,9 +673,9 @@ class ProjectsClient:
|
|
|
513
673
|
try:
|
|
514
674
|
if 200 <= _response.status_code < 300:
|
|
515
675
|
return typing.cast(
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
type_=
|
|
676
|
+
LseProjectUpdate,
|
|
677
|
+
construct_type(
|
|
678
|
+
type_=LseProjectUpdate, # type: ignore
|
|
519
679
|
object_=_response.json(),
|
|
520
680
|
),
|
|
521
681
|
)
|
|
@@ -524,97 +684,187 @@ class ProjectsClient:
|
|
|
524
684
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
525
685
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
526
686
|
|
|
527
|
-
def
|
|
687
|
+
def duplicate(
|
|
528
688
|
self,
|
|
529
689
|
id: int,
|
|
530
690
|
*,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
691
|
+
mode: ModeEnum,
|
|
692
|
+
workspace: int,
|
|
693
|
+
title: str,
|
|
694
|
+
description: typing.Optional[str] = OMIT,
|
|
535
695
|
request_options: typing.Optional[RequestOptions] = None,
|
|
536
|
-
) ->
|
|
696
|
+
) -> ProjectsDuplicateResponse:
|
|
537
697
|
"""
|
|
698
|
+
Make a copy of project.
|
|
538
699
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
<Note>
|
|
543
|
-
Imported data is verified against a project *label_config* and must include all variables that were used in the *label_config*.
|
|
544
|
-
|
|
545
|
-
For example, if the label configuration has a *$text* variable, then each item in a data object must include a `text` field.
|
|
546
|
-
</Note>
|
|
547
|
-
|
|
548
|
-
There are three possible ways to import tasks with this endpoint:
|
|
549
|
-
|
|
550
|
-
#### 1. **POST with data**
|
|
551
|
-
Send JSON tasks as POST data. Only JSON is supported for POSTing files directly.
|
|
700
|
+
Parameters
|
|
701
|
+
----------
|
|
702
|
+
id : int
|
|
552
703
|
|
|
553
|
-
|
|
554
|
-
|
|
704
|
+
mode : ModeEnum
|
|
705
|
+
Data that you want to duplicate: settings only, with tasks, with annotations
|
|
555
706
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
```
|
|
707
|
+
* `settings` - Only settings
|
|
708
|
+
* `settings,data` - Settings and tasks
|
|
559
709
|
|
|
560
|
-
|
|
561
|
-
|
|
710
|
+
workspace : int
|
|
711
|
+
Workspace, where to place duplicated project
|
|
562
712
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
- **TSV**: text files with tables in Tab Separated Value format
|
|
566
|
-
- **TXT**: simple text files are similar to CSV with one column and no header, supported for projects with one source only
|
|
713
|
+
title : str
|
|
714
|
+
Title of duplicated project
|
|
567
715
|
|
|
568
|
-
|
|
569
|
-
|
|
716
|
+
description : typing.Optional[str]
|
|
717
|
+
Description of duplicated project
|
|
570
718
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
```
|
|
719
|
+
request_options : typing.Optional[RequestOptions]
|
|
720
|
+
Request-specific configuration.
|
|
574
721
|
|
|
575
|
-
|
|
576
|
-
|
|
722
|
+
Returns
|
|
723
|
+
-------
|
|
724
|
+
ProjectsDuplicateResponse
|
|
725
|
+
Project duplicated
|
|
577
726
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
727
|
+
Examples
|
|
728
|
+
--------
|
|
729
|
+
from label_studio_sdk import LabelStudio
|
|
581
730
|
|
|
582
|
-
|
|
731
|
+
client = LabelStudio(
|
|
732
|
+
api_key="YOUR_API_KEY",
|
|
733
|
+
)
|
|
734
|
+
client.projects.duplicate(
|
|
735
|
+
id=1,
|
|
736
|
+
mode="settings",
|
|
737
|
+
workspace=1,
|
|
738
|
+
title="title",
|
|
739
|
+
)
|
|
740
|
+
"""
|
|
741
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
742
|
+
f"api/projects/{jsonable_encoder(id)}/duplicate/",
|
|
743
|
+
method="POST",
|
|
744
|
+
json={
|
|
745
|
+
"mode": mode,
|
|
746
|
+
"workspace": workspace,
|
|
747
|
+
"title": title,
|
|
748
|
+
"description": description,
|
|
749
|
+
},
|
|
750
|
+
headers={
|
|
751
|
+
"content-type": "application/json",
|
|
752
|
+
},
|
|
753
|
+
request_options=request_options,
|
|
754
|
+
omit=OMIT,
|
|
755
|
+
)
|
|
756
|
+
try:
|
|
757
|
+
if 200 <= _response.status_code < 300:
|
|
758
|
+
return typing.cast(
|
|
759
|
+
ProjectsDuplicateResponse,
|
|
760
|
+
construct_type(
|
|
761
|
+
type_=ProjectsDuplicateResponse, # type: ignore
|
|
762
|
+
object_=_response.json(),
|
|
763
|
+
),
|
|
764
|
+
)
|
|
765
|
+
_response_json = _response.json()
|
|
766
|
+
except JSONDecodeError:
|
|
767
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
768
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
583
769
|
|
|
770
|
+
def import_tasks(
|
|
771
|
+
self,
|
|
772
|
+
id: int,
|
|
773
|
+
*,
|
|
774
|
+
request: typing.Sequence[ImportApiRequest],
|
|
775
|
+
commit_to_project: typing.Optional[bool] = None,
|
|
776
|
+
preannotated_from_fields: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
777
|
+
return_task_ids: typing.Optional[bool] = None,
|
|
778
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
779
|
+
) -> ProjectsImportTasksResponse:
|
|
780
|
+
"""
|
|
781
|
+
|
|
782
|
+
Import data as labeling tasks in bulk using this API endpoint. You can use this API endpoint to import multiple tasks.
|
|
783
|
+
One POST request is limited at 250K tasks and 200 MB.
|
|
784
|
+
|
|
785
|
+
**Note:** Imported data is verified against a project *label_config* and must
|
|
786
|
+
include all variables that were used in the *label_config*. For example,
|
|
787
|
+
if the label configuration has a *$text* variable, then each item in a data object
|
|
788
|
+
must include a "text" field.
|
|
789
|
+
<br>
|
|
790
|
+
|
|
791
|
+
## POST requests
|
|
792
|
+
<hr style="opacity:0.3">
|
|
793
|
+
|
|
794
|
+
There are three possible ways to import tasks with this endpoint:
|
|
795
|
+
|
|
796
|
+
### 1. **POST with data**
|
|
797
|
+
Send JSON tasks as POST data. Only JSON is supported for POSTing files directly.
|
|
798
|
+
Update this example to specify your authorization token and Label Studio instance host, then run the following from
|
|
799
|
+
the command line.
|
|
800
|
+
|
|
801
|
+
```bash
|
|
802
|
+
curl -H 'Content-Type: application/json' -H 'Authorization: Token abc123' \
|
|
803
|
+
-X POST 'http://localhost:8000/api/projects/1/import' --data '[{"text": "Some text 1"}, {"text": "Some text 2"}]'
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
### 2. **POST with files**
|
|
807
|
+
Send tasks as files. You can attach multiple files with different names.
|
|
808
|
+
|
|
809
|
+
- **JSON**: text files in JavaScript object notation format
|
|
810
|
+
- **CSV**: text files with tables in Comma Separated Values format
|
|
811
|
+
- **TSV**: text files with tables in Tab Separated Value format
|
|
812
|
+
- **TXT**: simple text files are similar to CSV with one column and no header, supported for projects with one source only
|
|
813
|
+
|
|
814
|
+
Update this example to specify your authorization token, Label Studio instance host, and file name and path,
|
|
815
|
+
then run the following from the command line:
|
|
816
|
+
|
|
817
|
+
```bash
|
|
818
|
+
curl -H 'Authorization: Token abc123' \
|
|
819
|
+
-X POST 'http://localhost:8000/api/projects/1/import' -F 'file=@path/to/my_file.csv'
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
### 3. **POST with URL**
|
|
823
|
+
You can also provide a URL to a file with labeling tasks. Supported file formats are the same as in option 2.
|
|
824
|
+
|
|
825
|
+
```bash
|
|
826
|
+
curl -H 'Content-Type: application/json' -H 'Authorization: Token abc123' \
|
|
827
|
+
-X POST 'http://localhost:8000/api/projects/1/import' \
|
|
828
|
+
--data '[{"url": "http://example.com/test1.csv"}, {"url": "http://example.com/test2.csv"}]'
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
<br>
|
|
832
|
+
|
|
833
|
+
|
|
584
834
|
Parameters
|
|
585
835
|
----------
|
|
586
836
|
id : int
|
|
587
837
|
A unique integer value identifying this project.
|
|
588
|
-
|
|
589
|
-
request : typing.Sequence[
|
|
590
|
-
|
|
838
|
+
|
|
839
|
+
request : typing.Sequence[ImportApiRequest]
|
|
840
|
+
|
|
591
841
|
commit_to_project : typing.Optional[bool]
|
|
592
842
|
Set to "true" to immediately commit tasks to the project.
|
|
593
|
-
|
|
594
|
-
return_task_ids : typing.Optional[bool]
|
|
595
|
-
Set to "true" to return task IDs in the response.
|
|
596
|
-
|
|
843
|
+
|
|
597
844
|
preannotated_from_fields : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
598
845
|
List of fields to preannotate from the task data. For example, if you provide a list of `{"text": "text", "prediction": "label"}` items in the request, the system will create a task with the `text` field and a prediction with the `label` field when `preannoted_from_fields=["prediction"]`.
|
|
599
|
-
|
|
846
|
+
|
|
847
|
+
return_task_ids : typing.Optional[bool]
|
|
848
|
+
Set to "true" to return task IDs in the response.
|
|
849
|
+
|
|
600
850
|
request_options : typing.Optional[RequestOptions]
|
|
601
851
|
Request-specific configuration.
|
|
602
|
-
|
|
852
|
+
|
|
603
853
|
Returns
|
|
604
854
|
-------
|
|
605
855
|
ProjectsImportTasksResponse
|
|
606
856
|
Tasks successfully imported
|
|
607
|
-
|
|
857
|
+
|
|
608
858
|
Examples
|
|
609
859
|
--------
|
|
610
860
|
from label_studio_sdk import LabelStudio
|
|
611
|
-
|
|
861
|
+
|
|
612
862
|
client = LabelStudio(
|
|
613
863
|
api_key="YOUR_API_KEY",
|
|
614
864
|
)
|
|
615
865
|
client.projects.import_tasks(
|
|
616
866
|
id=1,
|
|
617
|
-
request=[
|
|
867
|
+
request=[],
|
|
618
868
|
)
|
|
619
869
|
"""
|
|
620
870
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -622,10 +872,12 @@ class ProjectsClient:
|
|
|
622
872
|
method="POST",
|
|
623
873
|
params={
|
|
624
874
|
"commit_to_project": commit_to_project,
|
|
625
|
-
"return_task_ids": return_task_ids,
|
|
626
875
|
"preannotated_from_fields": preannotated_from_fields,
|
|
876
|
+
"return_task_ids": return_task_ids,
|
|
627
877
|
},
|
|
628
|
-
json=
|
|
878
|
+
json=convert_and_respect_annotation_metadata(
|
|
879
|
+
object_=request, annotation=typing.Sequence[ImportApiRequest], direction="write"
|
|
880
|
+
),
|
|
629
881
|
request_options=request_options,
|
|
630
882
|
omit=OMIT,
|
|
631
883
|
)
|
|
@@ -633,7 +885,7 @@ class ProjectsClient:
|
|
|
633
885
|
if 200 <= _response.status_code < 300:
|
|
634
886
|
return typing.cast(
|
|
635
887
|
ProjectsImportTasksResponse,
|
|
636
|
-
|
|
888
|
+
construct_type(
|
|
637
889
|
type_=ProjectsImportTasksResponse, # type: ignore
|
|
638
890
|
object_=_response.json(),
|
|
639
891
|
),
|
|
@@ -642,7 +894,7 @@ class ProjectsClient:
|
|
|
642
894
|
raise BadRequestError(
|
|
643
895
|
typing.cast(
|
|
644
896
|
typing.Optional[typing.Any],
|
|
645
|
-
|
|
897
|
+
construct_type(
|
|
646
898
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
647
899
|
object_=_response.json(),
|
|
648
900
|
),
|
|
@@ -653,14 +905,11 @@ class ProjectsClient:
|
|
|
653
905
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
654
906
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
655
907
|
|
|
656
|
-
def
|
|
908
|
+
def validate_label_config(
|
|
657
909
|
self, id: int, *, label_config: str, request_options: typing.Optional[RequestOptions] = None
|
|
658
910
|
) -> ProjectLabelConfig:
|
|
659
911
|
"""
|
|
660
|
-
|
|
661
|
-
Determine whether the label configuration for a specific project is valid. For more information about setting up labeling configs, see [Configure labeling interface](https://labelstud.io/guide/setup) and our [Tags reference](https://labelstud.io/tags/).
|
|
662
|
-
|
|
663
|
-
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](list).
|
|
912
|
+
Determine whether the label configuration for a specific project is valid.
|
|
664
913
|
|
|
665
914
|
Parameters
|
|
666
915
|
----------
|
|
@@ -685,7 +934,7 @@ class ProjectsClient:
|
|
|
685
934
|
client = LabelStudio(
|
|
686
935
|
api_key="YOUR_API_KEY",
|
|
687
936
|
)
|
|
688
|
-
client.projects.
|
|
937
|
+
client.projects.validate_label_config(
|
|
689
938
|
id=1,
|
|
690
939
|
label_config="label_config",
|
|
691
940
|
)
|
|
@@ -703,7 +952,7 @@ class ProjectsClient:
|
|
|
703
952
|
if 200 <= _response.status_code < 300:
|
|
704
953
|
return typing.cast(
|
|
705
954
|
ProjectLabelConfig,
|
|
706
|
-
|
|
955
|
+
construct_type(
|
|
707
956
|
type_=ProjectLabelConfig, # type: ignore
|
|
708
957
|
object_=_response.json(),
|
|
709
958
|
),
|
|
@@ -717,44 +966,39 @@ class ProjectsClient:
|
|
|
717
966
|
class AsyncProjectsClient:
|
|
718
967
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
719
968
|
self._client_wrapper = client_wrapper
|
|
720
|
-
self.pauses = AsyncPausesClient(client_wrapper=self._client_wrapper)
|
|
721
969
|
self.exports = AsyncExportsClient(client_wrapper=self._client_wrapper)
|
|
970
|
+
self.stats = AsyncStatsClient(client_wrapper=self._client_wrapper)
|
|
971
|
+
self.pauses = AsyncPausesClient(client_wrapper=self._client_wrapper)
|
|
722
972
|
|
|
723
973
|
async def list(
|
|
724
974
|
self,
|
|
725
975
|
*,
|
|
726
|
-
|
|
976
|
+
filter: typing.Optional[ProjectsListRequestFilter] = None,
|
|
727
977
|
ids: typing.Optional[str] = None,
|
|
728
|
-
|
|
978
|
+
include: typing.Optional[str] = None,
|
|
979
|
+
ordering: typing.Optional[str] = None,
|
|
729
980
|
page: typing.Optional[int] = None,
|
|
730
981
|
page_size: typing.Optional[int] = None,
|
|
982
|
+
title: typing.Optional[str] = None,
|
|
731
983
|
workspaces: typing.Optional[int] = None,
|
|
732
|
-
include: typing.Optional[str] = None,
|
|
733
|
-
filter: typing.Optional[ProjectsListRequestFilter] = None,
|
|
734
984
|
request_options: typing.Optional[RequestOptions] = None,
|
|
735
|
-
) -> AsyncPager[
|
|
985
|
+
) -> AsyncPager[AllRolesProjectList]:
|
|
736
986
|
"""
|
|
737
|
-
|
|
738
|
-
Return a list of the projects within your organization.
|
|
739
|
-
|
|
740
|
-
To perform most tasks with the Label Studio API, you must specify the project ID, sometimes referred to as the `pk`. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using this API call.
|
|
741
|
-
|
|
742
|
-
To retrieve a list of your Label Studio projects, update the following command to match your own environment.
|
|
743
|
-
Replace the domain name, port, and authorization token, then run the following from the command line:
|
|
744
|
-
```bash
|
|
745
|
-
curl -X GET https://localhost:8080/api/projects/ -H 'Authorization: Token abc123'
|
|
746
|
-
```
|
|
987
|
+
Retrieve a list of projects.
|
|
747
988
|
|
|
748
989
|
Parameters
|
|
749
990
|
----------
|
|
750
|
-
|
|
751
|
-
|
|
991
|
+
filter : typing.Optional[ProjectsListRequestFilter]
|
|
992
|
+
Filter projects by pinned status. Use 'pinned_only' to return only pinned projects, 'exclude_pinned' to return only non-pinned projects, or 'all' to return all projects.
|
|
752
993
|
|
|
753
994
|
ids : typing.Optional[str]
|
|
754
995
|
ids
|
|
755
996
|
|
|
756
|
-
|
|
757
|
-
|
|
997
|
+
include : typing.Optional[str]
|
|
998
|
+
Comma-separated list of count fields to include in the response to optimize performance. Available fields: task_number, finished_task_number, total_predictions_number, total_annotations_number, num_tasks_with_annotations, useful_annotation_number, ground_truth_number, skipped_annotations_number. If not specified, all count fields are included.
|
|
999
|
+
|
|
1000
|
+
ordering : typing.Optional[str]
|
|
1001
|
+
Which field to use when ordering the results.
|
|
758
1002
|
|
|
759
1003
|
page : typing.Optional[int]
|
|
760
1004
|
A page number within the paginated result set.
|
|
@@ -762,21 +1006,18 @@ class AsyncProjectsClient:
|
|
|
762
1006
|
page_size : typing.Optional[int]
|
|
763
1007
|
Number of results to return per page.
|
|
764
1008
|
|
|
1009
|
+
title : typing.Optional[str]
|
|
1010
|
+
title
|
|
1011
|
+
|
|
765
1012
|
workspaces : typing.Optional[int]
|
|
766
1013
|
workspaces
|
|
767
1014
|
|
|
768
|
-
include : typing.Optional[str]
|
|
769
|
-
Comma-separated list of count fields to include in the response to optimize performance. Available fields: task_number, finished_task_number, total_predictions_number, total_annotations_number, num_tasks_with_annotations, useful_annotation_number, ground_truth_number, skipped_annotations_number. If not specified, all count fields are included.
|
|
770
|
-
|
|
771
|
-
filter : typing.Optional[ProjectsListRequestFilter]
|
|
772
|
-
Filter projects by pinned status. Use 'pinned_only' to return only pinned projects, 'exclude_pinned' to return only non-pinned projects, or 'all' to return all projects.
|
|
773
|
-
|
|
774
1015
|
request_options : typing.Optional[RequestOptions]
|
|
775
1016
|
Request-specific configuration.
|
|
776
1017
|
|
|
777
1018
|
Returns
|
|
778
1019
|
-------
|
|
779
|
-
AsyncPager[
|
|
1020
|
+
AsyncPager[AllRolesProjectList]
|
|
780
1021
|
|
|
781
1022
|
|
|
782
1023
|
Examples
|
|
@@ -791,9 +1032,7 @@ class AsyncProjectsClient:
|
|
|
791
1032
|
|
|
792
1033
|
|
|
793
1034
|
async def main() -> None:
|
|
794
|
-
response = await client.projects.list(
|
|
795
|
-
include="task_number,total_annotations_number,num_tasks_with_annotations",
|
|
796
|
-
)
|
|
1035
|
+
response = await client.projects.list()
|
|
797
1036
|
async for item in response:
|
|
798
1037
|
yield item
|
|
799
1038
|
# alternatively, you can paginate page-by-page
|
|
@@ -808,36 +1047,36 @@ class AsyncProjectsClient:
|
|
|
808
1047
|
"api/projects/",
|
|
809
1048
|
method="GET",
|
|
810
1049
|
params={
|
|
811
|
-
"
|
|
1050
|
+
"filter": filter,
|
|
812
1051
|
"ids": ids,
|
|
813
|
-
"
|
|
1052
|
+
"include": include,
|
|
1053
|
+
"ordering": ordering,
|
|
814
1054
|
"page": page,
|
|
815
1055
|
"page_size": page_size,
|
|
1056
|
+
"title": title,
|
|
816
1057
|
"workspaces": workspaces,
|
|
817
|
-
"include": include,
|
|
818
|
-
"filter": filter,
|
|
819
1058
|
},
|
|
820
1059
|
request_options=request_options,
|
|
821
1060
|
)
|
|
822
1061
|
try:
|
|
823
1062
|
if 200 <= _response.status_code < 300:
|
|
824
1063
|
_parsed_response = typing.cast(
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
type_=
|
|
1064
|
+
PaginatedAllRolesProjectListList,
|
|
1065
|
+
construct_type(
|
|
1066
|
+
type_=PaginatedAllRolesProjectListList, # type: ignore
|
|
828
1067
|
object_=_response.json(),
|
|
829
1068
|
),
|
|
830
1069
|
)
|
|
831
1070
|
_has_next = True
|
|
832
1071
|
_get_next = lambda: self.list(
|
|
833
|
-
|
|
1072
|
+
filter=filter,
|
|
834
1073
|
ids=ids,
|
|
835
|
-
|
|
1074
|
+
include=include,
|
|
1075
|
+
ordering=ordering,
|
|
836
1076
|
page=page + 1,
|
|
837
1077
|
page_size=page_size,
|
|
1078
|
+
title=title,
|
|
838
1079
|
workspaces=workspaces,
|
|
839
|
-
include=include,
|
|
840
|
-
filter=filter,
|
|
841
1080
|
request_options=request_options,
|
|
842
1081
|
)
|
|
843
1082
|
_items = _parsed_response.results
|
|
@@ -858,80 +1097,118 @@ class AsyncProjectsClient:
|
|
|
858
1097
|
show_skip_button: typing.Optional[bool] = OMIT,
|
|
859
1098
|
enable_empty_annotation: typing.Optional[bool] = OMIT,
|
|
860
1099
|
show_annotation_history: typing.Optional[bool] = OMIT,
|
|
861
|
-
|
|
862
|
-
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
863
|
-
maximum_annotations: typing.Optional[int] = OMIT,
|
|
1100
|
+
organization: typing.Optional[int] = OMIT,
|
|
864
1101
|
color: typing.Optional[str] = OMIT,
|
|
865
|
-
|
|
866
|
-
|
|
1102
|
+
maximum_annotations: typing.Optional[int] = OMIT,
|
|
1103
|
+
is_published: typing.Optional[bool] = OMIT,
|
|
867
1104
|
model_version: typing.Optional[str] = OMIT,
|
|
1105
|
+
is_draft: typing.Optional[bool] = OMIT,
|
|
1106
|
+
created_by: typing.Optional[UserSimpleRequest] = OMIT,
|
|
1107
|
+
min_annotations_to_start_training: typing.Optional[int] = OMIT,
|
|
1108
|
+
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
1109
|
+
sampling: typing.Optional[LseProjectCreateRequestSampling] = OMIT,
|
|
1110
|
+
show_ground_truth_first: typing.Optional[bool] = OMIT,
|
|
1111
|
+
show_overlap_first: typing.Optional[bool] = OMIT,
|
|
1112
|
+
overlap_cohort_percentage: typing.Optional[int] = OMIT,
|
|
1113
|
+
task_data_login: typing.Optional[str] = OMIT,
|
|
1114
|
+
task_data_password: typing.Optional[str] = OMIT,
|
|
1115
|
+
control_weights: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
1116
|
+
evaluate_predictions_automatically: typing.Optional[bool] = OMIT,
|
|
1117
|
+
skip_queue: typing.Optional[LseProjectCreateRequestSkipQueue] = OMIT,
|
|
1118
|
+
reveal_preannotations_interactively: typing.Optional[bool] = OMIT,
|
|
1119
|
+
pinned_at: typing.Optional[dt.datetime] = OMIT,
|
|
1120
|
+
workspace: typing.Optional[int] = OMIT,
|
|
868
1121
|
request_options: typing.Optional[RequestOptions] = None,
|
|
869
|
-
) ->
|
|
1122
|
+
) -> LseProjectCreate:
|
|
870
1123
|
"""
|
|
871
|
-
|
|
872
|
-
Create a project and set up the labeling interface. For more information about setting up projects, see the following:
|
|
873
|
-
* [Create and configure projects](https://labelstud.io/guide/setup_project)
|
|
874
|
-
* [Configure labeling interface](https://labelstud.io/guide/setup)
|
|
875
|
-
* [Project settings](https://labelstud.io/guide/project_settings)
|
|
876
|
-
|
|
877
|
-
```bash
|
|
878
|
-
curl -H Content-Type:application/json -H 'Authorization: Token abc123' -X POST 'https://localhost:8080/api/projects' --data '{"label_config": "<View>[...]</View>"}'
|
|
879
|
-
```
|
|
1124
|
+
Create a project for a specific organization.
|
|
880
1125
|
|
|
881
1126
|
Parameters
|
|
882
1127
|
----------
|
|
883
1128
|
title : typing.Optional[str]
|
|
884
|
-
Project
|
|
1129
|
+
Project name. Must be between 3 and 50 characters long.
|
|
885
1130
|
|
|
886
1131
|
description : typing.Optional[str]
|
|
887
1132
|
Project description
|
|
888
1133
|
|
|
889
1134
|
label_config : typing.Optional[str]
|
|
890
|
-
Label config in XML format
|
|
1135
|
+
Label config in XML format. See more about it in documentation
|
|
891
1136
|
|
|
892
1137
|
expert_instruction : typing.Optional[str]
|
|
893
|
-
Labeling instructions
|
|
1138
|
+
Labeling instructions in HTML format
|
|
894
1139
|
|
|
895
1140
|
show_instruction : typing.Optional[bool]
|
|
896
|
-
Show
|
|
1141
|
+
Show instructions to the annotator before they start
|
|
897
1142
|
|
|
898
1143
|
show_skip_button : typing.Optional[bool]
|
|
899
|
-
Show skip button
|
|
1144
|
+
Show a skip button in interface and allow annotators to skip the task
|
|
900
1145
|
|
|
901
1146
|
enable_empty_annotation : typing.Optional[bool]
|
|
902
|
-
Allow empty annotations
|
|
1147
|
+
Allow annotators to submit empty annotations
|
|
903
1148
|
|
|
904
1149
|
show_annotation_history : typing.Optional[bool]
|
|
905
|
-
Show annotation history
|
|
1150
|
+
Show annotation history to annotator
|
|
906
1151
|
|
|
907
|
-
|
|
908
|
-
Reveal preannotations interactively. If set to True, predictions will be shown to the user only after selecting the area of interest
|
|
1152
|
+
organization : typing.Optional[int]
|
|
909
1153
|
|
|
910
|
-
|
|
911
|
-
Show predictions to annotators
|
|
1154
|
+
color : typing.Optional[str]
|
|
912
1155
|
|
|
913
1156
|
maximum_annotations : typing.Optional[int]
|
|
914
|
-
Maximum annotations per task
|
|
1157
|
+
Maximum number of annotations for one task. If the number of annotations per task is equal or greater to this value, the task is completed (is_labeled=True)
|
|
915
1158
|
|
|
916
|
-
|
|
917
|
-
|
|
1159
|
+
is_published : typing.Optional[bool]
|
|
1160
|
+
Whether or not the project is published to annotators
|
|
918
1161
|
|
|
919
|
-
|
|
920
|
-
|
|
1162
|
+
model_version : typing.Optional[str]
|
|
1163
|
+
Machine learning model version
|
|
921
1164
|
|
|
1165
|
+
is_draft : typing.Optional[bool]
|
|
1166
|
+
Whether or not the project is in the middle of being created
|
|
922
1167
|
|
|
923
|
-
|
|
924
|
-
|
|
1168
|
+
created_by : typing.Optional[UserSimpleRequest]
|
|
1169
|
+
Project owner
|
|
925
1170
|
|
|
926
|
-
|
|
927
|
-
|
|
1171
|
+
min_annotations_to_start_training : typing.Optional[int]
|
|
1172
|
+
Minimum number of completed tasks after which model training is started
|
|
1173
|
+
|
|
1174
|
+
show_collab_predictions : typing.Optional[bool]
|
|
1175
|
+
If set, the annotator can view model predictions
|
|
1176
|
+
|
|
1177
|
+
sampling : typing.Optional[LseProjectCreateRequestSampling]
|
|
1178
|
+
|
|
1179
|
+
show_ground_truth_first : typing.Optional[bool]
|
|
1180
|
+
|
|
1181
|
+
show_overlap_first : typing.Optional[bool]
|
|
1182
|
+
|
|
1183
|
+
overlap_cohort_percentage : typing.Optional[int]
|
|
1184
|
+
|
|
1185
|
+
task_data_login : typing.Optional[str]
|
|
1186
|
+
Task data credentials: login
|
|
1187
|
+
|
|
1188
|
+
task_data_password : typing.Optional[str]
|
|
1189
|
+
Task data credentials: password
|
|
1190
|
+
|
|
1191
|
+
control_weights : typing.Optional[typing.Optional[typing.Any]]
|
|
1192
|
+
|
|
1193
|
+
evaluate_predictions_automatically : typing.Optional[bool]
|
|
1194
|
+
Retrieve and display predictions when loading a task
|
|
1195
|
+
|
|
1196
|
+
skip_queue : typing.Optional[LseProjectCreateRequestSkipQueue]
|
|
1197
|
+
|
|
1198
|
+
reveal_preannotations_interactively : typing.Optional[bool]
|
|
1199
|
+
Reveal pre-annotations interactively
|
|
1200
|
+
|
|
1201
|
+
pinned_at : typing.Optional[dt.datetime]
|
|
1202
|
+
Pinned date and time
|
|
1203
|
+
|
|
1204
|
+
workspace : typing.Optional[int]
|
|
928
1205
|
|
|
929
1206
|
request_options : typing.Optional[RequestOptions]
|
|
930
1207
|
Request-specific configuration.
|
|
931
1208
|
|
|
932
1209
|
Returns
|
|
933
1210
|
-------
|
|
934
|
-
|
|
1211
|
+
LseProjectCreate
|
|
935
1212
|
|
|
936
1213
|
|
|
937
1214
|
Examples
|
|
@@ -963,13 +1240,33 @@ class AsyncProjectsClient:
|
|
|
963
1240
|
"show_skip_button": show_skip_button,
|
|
964
1241
|
"enable_empty_annotation": enable_empty_annotation,
|
|
965
1242
|
"show_annotation_history": show_annotation_history,
|
|
966
|
-
"
|
|
967
|
-
"show_collab_predictions": show_collab_predictions,
|
|
968
|
-
"maximum_annotations": maximum_annotations,
|
|
1243
|
+
"organization": organization,
|
|
969
1244
|
"color": color,
|
|
1245
|
+
"maximum_annotations": maximum_annotations,
|
|
1246
|
+
"is_published": is_published,
|
|
1247
|
+
"model_version": model_version,
|
|
1248
|
+
"is_draft": is_draft,
|
|
1249
|
+
"created_by": convert_and_respect_annotation_metadata(
|
|
1250
|
+
object_=created_by, annotation=UserSimpleRequest, direction="write"
|
|
1251
|
+
),
|
|
1252
|
+
"min_annotations_to_start_training": min_annotations_to_start_training,
|
|
1253
|
+
"show_collab_predictions": show_collab_predictions,
|
|
1254
|
+
"sampling": convert_and_respect_annotation_metadata(
|
|
1255
|
+
object_=sampling, annotation=LseProjectCreateRequestSampling, direction="write"
|
|
1256
|
+
),
|
|
1257
|
+
"show_ground_truth_first": show_ground_truth_first,
|
|
1258
|
+
"show_overlap_first": show_overlap_first,
|
|
1259
|
+
"overlap_cohort_percentage": overlap_cohort_percentage,
|
|
1260
|
+
"task_data_login": task_data_login,
|
|
1261
|
+
"task_data_password": task_data_password,
|
|
970
1262
|
"control_weights": control_weights,
|
|
1263
|
+
"evaluate_predictions_automatically": evaluate_predictions_automatically,
|
|
1264
|
+
"skip_queue": convert_and_respect_annotation_metadata(
|
|
1265
|
+
object_=skip_queue, annotation=LseProjectCreateRequestSkipQueue, direction="write"
|
|
1266
|
+
),
|
|
1267
|
+
"reveal_preannotations_interactively": reveal_preannotations_interactively,
|
|
1268
|
+
"pinned_at": pinned_at,
|
|
971
1269
|
"workspace": workspace,
|
|
972
|
-
"model_version": model_version,
|
|
973
1270
|
},
|
|
974
1271
|
headers={
|
|
975
1272
|
"content-type": "application/json",
|
|
@@ -980,9 +1277,9 @@ class AsyncProjectsClient:
|
|
|
980
1277
|
try:
|
|
981
1278
|
if 200 <= _response.status_code < 300:
|
|
982
1279
|
return typing.cast(
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
type_=
|
|
1280
|
+
LseProjectCreate,
|
|
1281
|
+
construct_type(
|
|
1282
|
+
type_=LseProjectCreate, # type: ignore
|
|
986
1283
|
object_=_response.json(),
|
|
987
1284
|
),
|
|
988
1285
|
)
|
|
@@ -993,12 +1290,11 @@ class AsyncProjectsClient:
|
|
|
993
1290
|
|
|
994
1291
|
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Project:
|
|
995
1292
|
"""
|
|
996
|
-
Retrieve information about a
|
|
1293
|
+
Retrieve information about a project by project ID.
|
|
997
1294
|
|
|
998
1295
|
Parameters
|
|
999
1296
|
----------
|
|
1000
1297
|
id : int
|
|
1001
|
-
A unique integer value identifying this project.
|
|
1002
1298
|
|
|
1003
1299
|
request_options : typing.Optional[RequestOptions]
|
|
1004
1300
|
Request-specific configuration.
|
|
@@ -1036,7 +1332,7 @@ class AsyncProjectsClient:
|
|
|
1036
1332
|
if 200 <= _response.status_code < 300:
|
|
1037
1333
|
return typing.cast(
|
|
1038
1334
|
Project,
|
|
1039
|
-
|
|
1335
|
+
construct_type(
|
|
1040
1336
|
type_=Project, # type: ignore
|
|
1041
1337
|
object_=_response.json(),
|
|
1042
1338
|
),
|
|
@@ -1048,15 +1344,11 @@ class AsyncProjectsClient:
|
|
|
1048
1344
|
|
|
1049
1345
|
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
1050
1346
|
"""
|
|
1051
|
-
|
|
1052
|
-
Delete a project by specified project ID. Deleting a project permanently removes all tasks, annotations, and project data from Label Studio.
|
|
1053
|
-
|
|
1054
|
-
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](list).
|
|
1347
|
+
Delete a project by specified project ID.
|
|
1055
1348
|
|
|
1056
1349
|
Parameters
|
|
1057
1350
|
----------
|
|
1058
1351
|
id : int
|
|
1059
|
-
A unique integer value identifying this project.
|
|
1060
1352
|
|
|
1061
1353
|
request_options : typing.Optional[RequestOptions]
|
|
1062
1354
|
Request-specific configuration.
|
|
@@ -1109,87 +1401,154 @@ class AsyncProjectsClient:
|
|
|
1109
1401
|
show_skip_button: typing.Optional[bool] = OMIT,
|
|
1110
1402
|
enable_empty_annotation: typing.Optional[bool] = OMIT,
|
|
1111
1403
|
show_annotation_history: typing.Optional[bool] = OMIT,
|
|
1112
|
-
|
|
1113
|
-
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
1114
|
-
maximum_annotations: typing.Optional[int] = OMIT,
|
|
1404
|
+
organization: typing.Optional[int] = OMIT,
|
|
1115
1405
|
color: typing.Optional[str] = OMIT,
|
|
1116
|
-
|
|
1117
|
-
|
|
1406
|
+
maximum_annotations: typing.Optional[int] = OMIT,
|
|
1407
|
+
is_published: typing.Optional[bool] = OMIT,
|
|
1118
1408
|
model_version: typing.Optional[str] = OMIT,
|
|
1409
|
+
is_draft: typing.Optional[bool] = OMIT,
|
|
1410
|
+
created_by: typing.Optional[UserSimpleRequest] = OMIT,
|
|
1411
|
+
min_annotations_to_start_training: typing.Optional[int] = OMIT,
|
|
1412
|
+
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
1413
|
+
sampling: typing.Optional[PatchedLseProjectUpdateRequestSampling] = OMIT,
|
|
1414
|
+
show_ground_truth_first: typing.Optional[bool] = OMIT,
|
|
1415
|
+
show_overlap_first: typing.Optional[bool] = OMIT,
|
|
1416
|
+
overlap_cohort_percentage: typing.Optional[int] = OMIT,
|
|
1417
|
+
task_data_login: typing.Optional[str] = OMIT,
|
|
1418
|
+
task_data_password: typing.Optional[str] = OMIT,
|
|
1419
|
+
control_weights: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
1420
|
+
evaluate_predictions_automatically: typing.Optional[bool] = OMIT,
|
|
1421
|
+
skip_queue: typing.Optional[PatchedLseProjectUpdateRequestSkipQueue] = OMIT,
|
|
1422
|
+
reveal_preannotations_interactively: typing.Optional[bool] = OMIT,
|
|
1423
|
+
pinned_at: typing.Optional[dt.datetime] = OMIT,
|
|
1424
|
+
workspace: typing.Optional[int] = OMIT,
|
|
1425
|
+
review_settings: typing.Optional[ReviewSettingsRequest] = OMIT,
|
|
1426
|
+
assignment_settings: typing.Optional[AssignmentSettingsRequest] = OMIT,
|
|
1427
|
+
custom_script: typing.Optional[str] = OMIT,
|
|
1428
|
+
comment_classification_config: typing.Optional[str] = OMIT,
|
|
1429
|
+
require_comment_on_skip: typing.Optional[bool] = OMIT,
|
|
1430
|
+
custom_task_lock_ttl: typing.Optional[int] = OMIT,
|
|
1431
|
+
annotation_limit_count: typing.Optional[int] = OMIT,
|
|
1432
|
+
annotation_limit_percent: typing.Optional[str] = OMIT,
|
|
1433
|
+
pause_on_failed_annotator_evaluation: typing.Optional[bool] = OMIT,
|
|
1434
|
+
annotator_evaluation_minimum_score: typing.Optional[str] = OMIT,
|
|
1435
|
+
annotator_evaluation_minimum_tasks: typing.Optional[int] = OMIT,
|
|
1119
1436
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1120
|
-
) ->
|
|
1437
|
+
) -> LseProjectUpdate:
|
|
1121
1438
|
"""
|
|
1122
|
-
|
|
1123
|
-
Update the project settings for a specific project. For more information, see the following:
|
|
1124
|
-
* [Create and configure projects](https://labelstud.io/guide/setup_project)
|
|
1125
|
-
* [Configure labeling interface](https://labelstud.io/guide/setup)
|
|
1126
|
-
* [Project settings](https://labelstud.io/guide/project_settings)
|
|
1127
|
-
|
|
1128
|
-
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](list).
|
|
1129
|
-
|
|
1130
|
-
<Warning>
|
|
1131
|
-
If you are modifying the labeling config for project that has in-progress work, note the following:
|
|
1132
|
-
* You cannot remove labels or change the type of labeling being performed unless you delete any existing annotations that are using those labels.
|
|
1133
|
-
* If you make changes to the labeling configuration, any tabs that you might have created in the Data Manager are removed.
|
|
1134
|
-
</Warning>
|
|
1439
|
+
Update the details of a specific project.
|
|
1135
1440
|
|
|
1136
1441
|
Parameters
|
|
1137
1442
|
----------
|
|
1138
1443
|
id : int
|
|
1139
|
-
A unique integer value identifying this project.
|
|
1140
1444
|
|
|
1141
1445
|
title : typing.Optional[str]
|
|
1142
|
-
Project
|
|
1446
|
+
Project name. Must be between 3 and 50 characters long.
|
|
1143
1447
|
|
|
1144
1448
|
description : typing.Optional[str]
|
|
1145
1449
|
Project description
|
|
1146
1450
|
|
|
1147
1451
|
label_config : typing.Optional[str]
|
|
1148
|
-
Label config in XML format
|
|
1452
|
+
Label config in XML format. See more about it in documentation
|
|
1149
1453
|
|
|
1150
1454
|
expert_instruction : typing.Optional[str]
|
|
1151
|
-
Labeling instructions
|
|
1455
|
+
Labeling instructions in HTML format
|
|
1152
1456
|
|
|
1153
1457
|
show_instruction : typing.Optional[bool]
|
|
1154
|
-
Show
|
|
1458
|
+
Show instructions to the annotator before they start
|
|
1155
1459
|
|
|
1156
1460
|
show_skip_button : typing.Optional[bool]
|
|
1157
|
-
Show skip button
|
|
1461
|
+
Show a skip button in interface and allow annotators to skip the task
|
|
1158
1462
|
|
|
1159
1463
|
enable_empty_annotation : typing.Optional[bool]
|
|
1160
|
-
Allow empty annotations
|
|
1464
|
+
Allow annotators to submit empty annotations
|
|
1161
1465
|
|
|
1162
1466
|
show_annotation_history : typing.Optional[bool]
|
|
1163
|
-
Show annotation history
|
|
1467
|
+
Show annotation history to annotator
|
|
1164
1468
|
|
|
1165
|
-
|
|
1166
|
-
Reveal preannotations interactively. If set to True, predictions will be shown to the user only after selecting the area of interest
|
|
1469
|
+
organization : typing.Optional[int]
|
|
1167
1470
|
|
|
1168
|
-
|
|
1169
|
-
Show predictions to annotators
|
|
1471
|
+
color : typing.Optional[str]
|
|
1170
1472
|
|
|
1171
1473
|
maximum_annotations : typing.Optional[int]
|
|
1172
|
-
Maximum annotations per task
|
|
1474
|
+
Maximum number of annotations for one task. If the number of annotations per task is equal or greater to this value, the task is completed (is_labeled=True)
|
|
1173
1475
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1476
|
+
is_published : typing.Optional[bool]
|
|
1477
|
+
Whether or not the project is published to annotators
|
|
1478
|
+
|
|
1479
|
+
model_version : typing.Optional[str]
|
|
1480
|
+
Machine learning model version
|
|
1481
|
+
|
|
1482
|
+
is_draft : typing.Optional[bool]
|
|
1483
|
+
Whether or not the project is in the middle of being created
|
|
1484
|
+
|
|
1485
|
+
created_by : typing.Optional[UserSimpleRequest]
|
|
1486
|
+
Project owner
|
|
1176
1487
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1488
|
+
min_annotations_to_start_training : typing.Optional[int]
|
|
1489
|
+
Minimum number of completed tasks after which model training is started
|
|
1179
1490
|
|
|
1491
|
+
show_collab_predictions : typing.Optional[bool]
|
|
1492
|
+
If set, the annotator can view model predictions
|
|
1493
|
+
|
|
1494
|
+
sampling : typing.Optional[PatchedLseProjectUpdateRequestSampling]
|
|
1495
|
+
|
|
1496
|
+
show_ground_truth_first : typing.Optional[bool]
|
|
1497
|
+
|
|
1498
|
+
show_overlap_first : typing.Optional[bool]
|
|
1499
|
+
|
|
1500
|
+
overlap_cohort_percentage : typing.Optional[int]
|
|
1501
|
+
|
|
1502
|
+
task_data_login : typing.Optional[str]
|
|
1503
|
+
Task data credentials: login
|
|
1504
|
+
|
|
1505
|
+
task_data_password : typing.Optional[str]
|
|
1506
|
+
Task data credentials: password
|
|
1507
|
+
|
|
1508
|
+
control_weights : typing.Optional[typing.Optional[typing.Any]]
|
|
1509
|
+
|
|
1510
|
+
evaluate_predictions_automatically : typing.Optional[bool]
|
|
1511
|
+
Retrieve and display predictions when loading a task
|
|
1512
|
+
|
|
1513
|
+
skip_queue : typing.Optional[PatchedLseProjectUpdateRequestSkipQueue]
|
|
1514
|
+
|
|
1515
|
+
reveal_preannotations_interactively : typing.Optional[bool]
|
|
1516
|
+
Reveal pre-annotations interactively
|
|
1517
|
+
|
|
1518
|
+
pinned_at : typing.Optional[dt.datetime]
|
|
1519
|
+
Pinned date and time
|
|
1180
1520
|
|
|
1181
1521
|
workspace : typing.Optional[int]
|
|
1182
|
-
Workspace ID
|
|
1183
1522
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1523
|
+
review_settings : typing.Optional[ReviewSettingsRequest]
|
|
1524
|
+
|
|
1525
|
+
assignment_settings : typing.Optional[AssignmentSettingsRequest]
|
|
1526
|
+
|
|
1527
|
+
custom_script : typing.Optional[str]
|
|
1528
|
+
|
|
1529
|
+
comment_classification_config : typing.Optional[str]
|
|
1530
|
+
|
|
1531
|
+
require_comment_on_skip : typing.Optional[bool]
|
|
1532
|
+
|
|
1533
|
+
custom_task_lock_ttl : typing.Optional[int]
|
|
1534
|
+
TTL in seconds for task reservations, on new and existing tasks
|
|
1535
|
+
|
|
1536
|
+
annotation_limit_count : typing.Optional[int]
|
|
1537
|
+
|
|
1538
|
+
annotation_limit_percent : typing.Optional[str]
|
|
1539
|
+
|
|
1540
|
+
pause_on_failed_annotator_evaluation : typing.Optional[bool]
|
|
1541
|
+
|
|
1542
|
+
annotator_evaluation_minimum_score : typing.Optional[str]
|
|
1543
|
+
|
|
1544
|
+
annotator_evaluation_minimum_tasks : typing.Optional[int]
|
|
1186
1545
|
|
|
1187
1546
|
request_options : typing.Optional[RequestOptions]
|
|
1188
1547
|
Request-specific configuration.
|
|
1189
1548
|
|
|
1190
1549
|
Returns
|
|
1191
1550
|
-------
|
|
1192
|
-
|
|
1551
|
+
LseProjectUpdate
|
|
1193
1552
|
|
|
1194
1553
|
|
|
1195
1554
|
Examples
|
|
@@ -1223,13 +1582,48 @@ class AsyncProjectsClient:
|
|
|
1223
1582
|
"show_skip_button": show_skip_button,
|
|
1224
1583
|
"enable_empty_annotation": enable_empty_annotation,
|
|
1225
1584
|
"show_annotation_history": show_annotation_history,
|
|
1226
|
-
"
|
|
1227
|
-
"show_collab_predictions": show_collab_predictions,
|
|
1228
|
-
"maximum_annotations": maximum_annotations,
|
|
1585
|
+
"organization": organization,
|
|
1229
1586
|
"color": color,
|
|
1587
|
+
"maximum_annotations": maximum_annotations,
|
|
1588
|
+
"is_published": is_published,
|
|
1589
|
+
"model_version": model_version,
|
|
1590
|
+
"is_draft": is_draft,
|
|
1591
|
+
"created_by": convert_and_respect_annotation_metadata(
|
|
1592
|
+
object_=created_by, annotation=UserSimpleRequest, direction="write"
|
|
1593
|
+
),
|
|
1594
|
+
"min_annotations_to_start_training": min_annotations_to_start_training,
|
|
1595
|
+
"show_collab_predictions": show_collab_predictions,
|
|
1596
|
+
"sampling": convert_and_respect_annotation_metadata(
|
|
1597
|
+
object_=sampling, annotation=PatchedLseProjectUpdateRequestSampling, direction="write"
|
|
1598
|
+
),
|
|
1599
|
+
"show_ground_truth_first": show_ground_truth_first,
|
|
1600
|
+
"show_overlap_first": show_overlap_first,
|
|
1601
|
+
"overlap_cohort_percentage": overlap_cohort_percentage,
|
|
1602
|
+
"task_data_login": task_data_login,
|
|
1603
|
+
"task_data_password": task_data_password,
|
|
1230
1604
|
"control_weights": control_weights,
|
|
1605
|
+
"evaluate_predictions_automatically": evaluate_predictions_automatically,
|
|
1606
|
+
"skip_queue": convert_and_respect_annotation_metadata(
|
|
1607
|
+
object_=skip_queue, annotation=PatchedLseProjectUpdateRequestSkipQueue, direction="write"
|
|
1608
|
+
),
|
|
1609
|
+
"reveal_preannotations_interactively": reveal_preannotations_interactively,
|
|
1610
|
+
"pinned_at": pinned_at,
|
|
1231
1611
|
"workspace": workspace,
|
|
1232
|
-
"
|
|
1612
|
+
"review_settings": convert_and_respect_annotation_metadata(
|
|
1613
|
+
object_=review_settings, annotation=ReviewSettingsRequest, direction="write"
|
|
1614
|
+
),
|
|
1615
|
+
"assignment_settings": convert_and_respect_annotation_metadata(
|
|
1616
|
+
object_=assignment_settings, annotation=AssignmentSettingsRequest, direction="write"
|
|
1617
|
+
),
|
|
1618
|
+
"custom_script": custom_script,
|
|
1619
|
+
"comment_classification_config": comment_classification_config,
|
|
1620
|
+
"require_comment_on_skip": require_comment_on_skip,
|
|
1621
|
+
"custom_task_lock_ttl": custom_task_lock_ttl,
|
|
1622
|
+
"annotation_limit_count": annotation_limit_count,
|
|
1623
|
+
"annotation_limit_percent": annotation_limit_percent,
|
|
1624
|
+
"pause_on_failed_annotator_evaluation": pause_on_failed_annotator_evaluation,
|
|
1625
|
+
"annotator_evaluation_minimum_score": annotator_evaluation_minimum_score,
|
|
1626
|
+
"annotator_evaluation_minimum_tasks": annotator_evaluation_minimum_tasks,
|
|
1233
1627
|
},
|
|
1234
1628
|
headers={
|
|
1235
1629
|
"content-type": "application/json",
|
|
@@ -1240,9 +1634,9 @@ class AsyncProjectsClient:
|
|
|
1240
1634
|
try:
|
|
1241
1635
|
if 200 <= _response.status_code < 300:
|
|
1242
1636
|
return typing.cast(
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
type_=
|
|
1637
|
+
LseProjectUpdate,
|
|
1638
|
+
construct_type(
|
|
1639
|
+
type_=LseProjectUpdate, # type: ignore
|
|
1246
1640
|
object_=_response.json(),
|
|
1247
1641
|
),
|
|
1248
1642
|
)
|
|
@@ -1251,105 +1645,203 @@ class AsyncProjectsClient:
|
|
|
1251
1645
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1252
1646
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1253
1647
|
|
|
1254
|
-
async def
|
|
1648
|
+
async def duplicate(
|
|
1255
1649
|
self,
|
|
1256
1650
|
id: int,
|
|
1257
1651
|
*,
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1652
|
+
mode: ModeEnum,
|
|
1653
|
+
workspace: int,
|
|
1654
|
+
title: str,
|
|
1655
|
+
description: typing.Optional[str] = OMIT,
|
|
1262
1656
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1263
|
-
) ->
|
|
1657
|
+
) -> ProjectsDuplicateResponse:
|
|
1264
1658
|
"""
|
|
1659
|
+
Make a copy of project.
|
|
1265
1660
|
|
|
1266
|
-
|
|
1267
|
-
|
|
1661
|
+
Parameters
|
|
1662
|
+
----------
|
|
1663
|
+
id : int
|
|
1268
1664
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1665
|
+
mode : ModeEnum
|
|
1666
|
+
Data that you want to duplicate: settings only, with tasks, with annotations
|
|
1271
1667
|
|
|
1272
|
-
|
|
1273
|
-
|
|
1668
|
+
* `settings` - Only settings
|
|
1669
|
+
* `settings,data` - Settings and tasks
|
|
1274
1670
|
|
|
1275
|
-
|
|
1671
|
+
workspace : int
|
|
1672
|
+
Workspace, where to place duplicated project
|
|
1276
1673
|
|
|
1277
|
-
|
|
1278
|
-
|
|
1674
|
+
title : str
|
|
1675
|
+
Title of duplicated project
|
|
1279
1676
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1677
|
+
description : typing.Optional[str]
|
|
1678
|
+
Description of duplicated project
|
|
1282
1679
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
```
|
|
1680
|
+
request_options : typing.Optional[RequestOptions]
|
|
1681
|
+
Request-specific configuration.
|
|
1286
1682
|
|
|
1287
|
-
|
|
1288
|
-
|
|
1683
|
+
Returns
|
|
1684
|
+
-------
|
|
1685
|
+
ProjectsDuplicateResponse
|
|
1686
|
+
Project duplicated
|
|
1289
1687
|
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
- **TXT**: simple text files are similar to CSV with one column and no header, supported for projects with one source only
|
|
1688
|
+
Examples
|
|
1689
|
+
--------
|
|
1690
|
+
import asyncio
|
|
1294
1691
|
|
|
1295
|
-
|
|
1296
|
-
then run the following from the command line:
|
|
1692
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
1297
1693
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1694
|
+
client = AsyncLabelStudio(
|
|
1695
|
+
api_key="YOUR_API_KEY",
|
|
1696
|
+
)
|
|
1301
1697
|
|
|
1302
|
-
#### 3. **POST with URL**
|
|
1303
|
-
You can also provide a URL to a file with labeling tasks. Supported file formats are the same as in option 2.
|
|
1304
1698
|
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1699
|
+
async def main() -> None:
|
|
1700
|
+
await client.projects.duplicate(
|
|
1701
|
+
id=1,
|
|
1702
|
+
mode="settings",
|
|
1703
|
+
workspace=1,
|
|
1704
|
+
title="title",
|
|
1705
|
+
)
|
|
1308
1706
|
|
|
1309
|
-
<br>
|
|
1310
1707
|
|
|
1708
|
+
asyncio.run(main())
|
|
1709
|
+
"""
|
|
1710
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1711
|
+
f"api/projects/{jsonable_encoder(id)}/duplicate/",
|
|
1712
|
+
method="POST",
|
|
1713
|
+
json={
|
|
1714
|
+
"mode": mode,
|
|
1715
|
+
"workspace": workspace,
|
|
1716
|
+
"title": title,
|
|
1717
|
+
"description": description,
|
|
1718
|
+
},
|
|
1719
|
+
headers={
|
|
1720
|
+
"content-type": "application/json",
|
|
1721
|
+
},
|
|
1722
|
+
request_options=request_options,
|
|
1723
|
+
omit=OMIT,
|
|
1724
|
+
)
|
|
1725
|
+
try:
|
|
1726
|
+
if 200 <= _response.status_code < 300:
|
|
1727
|
+
return typing.cast(
|
|
1728
|
+
ProjectsDuplicateResponse,
|
|
1729
|
+
construct_type(
|
|
1730
|
+
type_=ProjectsDuplicateResponse, # type: ignore
|
|
1731
|
+
object_=_response.json(),
|
|
1732
|
+
),
|
|
1733
|
+
)
|
|
1734
|
+
_response_json = _response.json()
|
|
1735
|
+
except JSONDecodeError:
|
|
1736
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1737
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1738
|
+
|
|
1739
|
+
async def import_tasks(
|
|
1740
|
+
self,
|
|
1741
|
+
id: int,
|
|
1742
|
+
*,
|
|
1743
|
+
request: typing.Sequence[ImportApiRequest],
|
|
1744
|
+
commit_to_project: typing.Optional[bool] = None,
|
|
1745
|
+
preannotated_from_fields: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
1746
|
+
return_task_ids: typing.Optional[bool] = None,
|
|
1747
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1748
|
+
) -> ProjectsImportTasksResponse:
|
|
1749
|
+
"""
|
|
1750
|
+
|
|
1751
|
+
Import data as labeling tasks in bulk using this API endpoint. You can use this API endpoint to import multiple tasks.
|
|
1752
|
+
One POST request is limited at 250K tasks and 200 MB.
|
|
1753
|
+
|
|
1754
|
+
**Note:** Imported data is verified against a project *label_config* and must
|
|
1755
|
+
include all variables that were used in the *label_config*. For example,
|
|
1756
|
+
if the label configuration has a *$text* variable, then each item in a data object
|
|
1757
|
+
must include a "text" field.
|
|
1758
|
+
<br>
|
|
1759
|
+
|
|
1760
|
+
## POST requests
|
|
1761
|
+
<hr style="opacity:0.3">
|
|
1762
|
+
|
|
1763
|
+
There are three possible ways to import tasks with this endpoint:
|
|
1764
|
+
|
|
1765
|
+
### 1. **POST with data**
|
|
1766
|
+
Send JSON tasks as POST data. Only JSON is supported for POSTing files directly.
|
|
1767
|
+
Update this example to specify your authorization token and Label Studio instance host, then run the following from
|
|
1768
|
+
the command line.
|
|
1769
|
+
|
|
1770
|
+
```bash
|
|
1771
|
+
curl -H 'Content-Type: application/json' -H 'Authorization: Token abc123' \
|
|
1772
|
+
-X POST 'http://localhost:8000/api/projects/1/import' --data '[{"text": "Some text 1"}, {"text": "Some text 2"}]'
|
|
1773
|
+
```
|
|
1774
|
+
|
|
1775
|
+
### 2. **POST with files**
|
|
1776
|
+
Send tasks as files. You can attach multiple files with different names.
|
|
1777
|
+
|
|
1778
|
+
- **JSON**: text files in JavaScript object notation format
|
|
1779
|
+
- **CSV**: text files with tables in Comma Separated Values format
|
|
1780
|
+
- **TSV**: text files with tables in Tab Separated Value format
|
|
1781
|
+
- **TXT**: simple text files are similar to CSV with one column and no header, supported for projects with one source only
|
|
1782
|
+
|
|
1783
|
+
Update this example to specify your authorization token, Label Studio instance host, and file name and path,
|
|
1784
|
+
then run the following from the command line:
|
|
1785
|
+
|
|
1786
|
+
```bash
|
|
1787
|
+
curl -H 'Authorization: Token abc123' \
|
|
1788
|
+
-X POST 'http://localhost:8000/api/projects/1/import' -F 'file=@path/to/my_file.csv'
|
|
1789
|
+
```
|
|
1790
|
+
|
|
1791
|
+
### 3. **POST with URL**
|
|
1792
|
+
You can also provide a URL to a file with labeling tasks. Supported file formats are the same as in option 2.
|
|
1793
|
+
|
|
1794
|
+
```bash
|
|
1795
|
+
curl -H 'Content-Type: application/json' -H 'Authorization: Token abc123' \
|
|
1796
|
+
-X POST 'http://localhost:8000/api/projects/1/import' \
|
|
1797
|
+
--data '[{"url": "http://example.com/test1.csv"}, {"url": "http://example.com/test2.csv"}]'
|
|
1798
|
+
```
|
|
1799
|
+
|
|
1800
|
+
<br>
|
|
1801
|
+
|
|
1802
|
+
|
|
1311
1803
|
Parameters
|
|
1312
1804
|
----------
|
|
1313
1805
|
id : int
|
|
1314
1806
|
A unique integer value identifying this project.
|
|
1315
|
-
|
|
1316
|
-
request : typing.Sequence[
|
|
1317
|
-
|
|
1807
|
+
|
|
1808
|
+
request : typing.Sequence[ImportApiRequest]
|
|
1809
|
+
|
|
1318
1810
|
commit_to_project : typing.Optional[bool]
|
|
1319
1811
|
Set to "true" to immediately commit tasks to the project.
|
|
1320
|
-
|
|
1321
|
-
return_task_ids : typing.Optional[bool]
|
|
1322
|
-
Set to "true" to return task IDs in the response.
|
|
1323
|
-
|
|
1812
|
+
|
|
1324
1813
|
preannotated_from_fields : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
1325
1814
|
List of fields to preannotate from the task data. For example, if you provide a list of `{"text": "text", "prediction": "label"}` items in the request, the system will create a task with the `text` field and a prediction with the `label` field when `preannoted_from_fields=["prediction"]`.
|
|
1326
|
-
|
|
1815
|
+
|
|
1816
|
+
return_task_ids : typing.Optional[bool]
|
|
1817
|
+
Set to "true" to return task IDs in the response.
|
|
1818
|
+
|
|
1327
1819
|
request_options : typing.Optional[RequestOptions]
|
|
1328
1820
|
Request-specific configuration.
|
|
1329
|
-
|
|
1821
|
+
|
|
1330
1822
|
Returns
|
|
1331
1823
|
-------
|
|
1332
1824
|
ProjectsImportTasksResponse
|
|
1333
1825
|
Tasks successfully imported
|
|
1334
|
-
|
|
1826
|
+
|
|
1335
1827
|
Examples
|
|
1336
1828
|
--------
|
|
1337
1829
|
import asyncio
|
|
1338
|
-
|
|
1830
|
+
|
|
1339
1831
|
from label_studio_sdk import AsyncLabelStudio
|
|
1340
|
-
|
|
1832
|
+
|
|
1341
1833
|
client = AsyncLabelStudio(
|
|
1342
1834
|
api_key="YOUR_API_KEY",
|
|
1343
1835
|
)
|
|
1344
|
-
|
|
1345
|
-
|
|
1836
|
+
|
|
1837
|
+
|
|
1346
1838
|
async def main() -> None:
|
|
1347
1839
|
await client.projects.import_tasks(
|
|
1348
1840
|
id=1,
|
|
1349
|
-
request=[
|
|
1841
|
+
request=[],
|
|
1350
1842
|
)
|
|
1351
|
-
|
|
1352
|
-
|
|
1843
|
+
|
|
1844
|
+
|
|
1353
1845
|
asyncio.run(main())
|
|
1354
1846
|
"""
|
|
1355
1847
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -1357,10 +1849,12 @@ class AsyncProjectsClient:
|
|
|
1357
1849
|
method="POST",
|
|
1358
1850
|
params={
|
|
1359
1851
|
"commit_to_project": commit_to_project,
|
|
1360
|
-
"return_task_ids": return_task_ids,
|
|
1361
1852
|
"preannotated_from_fields": preannotated_from_fields,
|
|
1853
|
+
"return_task_ids": return_task_ids,
|
|
1362
1854
|
},
|
|
1363
|
-
json=
|
|
1855
|
+
json=convert_and_respect_annotation_metadata(
|
|
1856
|
+
object_=request, annotation=typing.Sequence[ImportApiRequest], direction="write"
|
|
1857
|
+
),
|
|
1364
1858
|
request_options=request_options,
|
|
1365
1859
|
omit=OMIT,
|
|
1366
1860
|
)
|
|
@@ -1368,7 +1862,7 @@ class AsyncProjectsClient:
|
|
|
1368
1862
|
if 200 <= _response.status_code < 300:
|
|
1369
1863
|
return typing.cast(
|
|
1370
1864
|
ProjectsImportTasksResponse,
|
|
1371
|
-
|
|
1865
|
+
construct_type(
|
|
1372
1866
|
type_=ProjectsImportTasksResponse, # type: ignore
|
|
1373
1867
|
object_=_response.json(),
|
|
1374
1868
|
),
|
|
@@ -1377,7 +1871,7 @@ class AsyncProjectsClient:
|
|
|
1377
1871
|
raise BadRequestError(
|
|
1378
1872
|
typing.cast(
|
|
1379
1873
|
typing.Optional[typing.Any],
|
|
1380
|
-
|
|
1874
|
+
construct_type(
|
|
1381
1875
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
1382
1876
|
object_=_response.json(),
|
|
1383
1877
|
),
|
|
@@ -1388,14 +1882,11 @@ class AsyncProjectsClient:
|
|
|
1388
1882
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1389
1883
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1390
1884
|
|
|
1391
|
-
async def
|
|
1885
|
+
async def validate_label_config(
|
|
1392
1886
|
self, id: int, *, label_config: str, request_options: typing.Optional[RequestOptions] = None
|
|
1393
1887
|
) -> ProjectLabelConfig:
|
|
1394
1888
|
"""
|
|
1395
|
-
|
|
1396
|
-
Determine whether the label configuration for a specific project is valid. For more information about setting up labeling configs, see [Configure labeling interface](https://labelstud.io/guide/setup) and our [Tags reference](https://labelstud.io/tags/).
|
|
1397
|
-
|
|
1398
|
-
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](list).
|
|
1889
|
+
Determine whether the label configuration for a specific project is valid.
|
|
1399
1890
|
|
|
1400
1891
|
Parameters
|
|
1401
1892
|
----------
|
|
@@ -1425,7 +1916,7 @@ class AsyncProjectsClient:
|
|
|
1425
1916
|
|
|
1426
1917
|
|
|
1427
1918
|
async def main() -> None:
|
|
1428
|
-
await client.projects.
|
|
1919
|
+
await client.projects.validate_label_config(
|
|
1429
1920
|
id=1,
|
|
1430
1921
|
label_config="label_config",
|
|
1431
1922
|
)
|
|
@@ -1446,7 +1937,7 @@ class AsyncProjectsClient:
|
|
|
1446
1937
|
if 200 <= _response.status_code < 300:
|
|
1447
1938
|
return typing.cast(
|
|
1448
1939
|
ProjectLabelConfig,
|
|
1449
|
-
|
|
1940
|
+
construct_type(
|
|
1450
1941
|
type_=ProjectLabelConfig, # type: ignore
|
|
1451
1942
|
object_=_response.json(),
|
|
1452
1943
|
),
|