Creates a new Amazon Rekognition project. A project is a group of resources (datasets, model versions) that you use to create and manage a Amazon Rekognition Custom Labels Model or custom adapter. You can specify a feature to create the project with, if no feature is specified then Custom Labels is used by default. For adapters, you can also choose whether or not to have the project auto update by using the AutoUpdate argument. This operation requires permissions to perform the rekognition:CreateProject action.
Parameters:
-
project_name
(ProjectName)
–
The name of the project to create.
-
feature
(Optional[CustomizationFeature], default:
None
)
–
Specifies feature that is being customized. If no value is provided CUSTOM_LABELS is used as a default.
-
auto_update
(Optional[ProjectAutoUpdate], default:
None
)
–
Specifies whether automatic retraining should be attempted for the versions of the project. Automatic retraining is done as a best effort. Required argument for Content Moderation. Applicable only to adapters.
-
tags
(Optional[TagMap], default:
None
)
–
A set of tags (key-value pairs) that you want to attach to the project.
Raises:
-
AccessDeniedException
–
You are not authorized to perform the action.
-
InternalServerError
–
Amazon Rekognition experienced a service issue. Try your call again.
-
InvalidParameterException
–
Input parameter violated a constraint. Validate your parameter before calling the API operation again.
-
LimitExceededException
–
An Amazon Rekognition service limit was exceeded. For example, if you start too many jobs concurrently, subsequent calls to start operations (ex: StartLabelDetection) will raise a LimitExceededException exception (HTTP status code: 400) until the number of concurrently running jobs is below the Amazon Rekognition service limit.
-
ProvisionedThroughputExceededException
–
The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.
-
ResourceInUseException
–
The specified resource is already being used.
-
ThrottlingException
–
Amazon Rekognition is temporarily unable to process the request. Try your call again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To create an Amazon Rekognition Custom Labels project
Creates an Amazon Rekognition Custom Labels project.
>>> client.create_project(project_name='my-project')
Source code in docs_src/capo_rekognition/_services/rekognition.py
| def create_project(
self,
project_name: "capo_rekognition.types.project_name.ProjectName",
*,
config_overrides: Optional[RekognitionClientConfig] = None,
feature: Optional[
"capo_rekognition.types.customization_feature.CustomizationFeature"
] = None,
auto_update: Optional[
"capo_rekognition.types.project_auto_update.ProjectAutoUpdate"
] = None,
tags: Optional["capo_rekognition.types.tag_map.TagMap"] = None,
) -> "capo_rekognition.types.create_project_response.CreateProjectResponse":
"""<p>Creates a new Amazon Rekognition project. A project is a group of resources (datasets, model versions) that you use to create and manage a Amazon Rekognition Custom Labels Model or custom adapter. You can specify a feature to create the project with, if no feature is specified then Custom Labels is used by default. For adapters, you can also choose whether or not to have the project auto update by using the AutoUpdate argument. This operation requires permissions to perform the <code>rekognition:CreateProject</code> action.</p>
Args:
project_name: <p>The name of the project to create.</p>
feature: <p>Specifies feature that is being customized. If no value is provided CUSTOM_LABELS is used as a default.</p>
auto_update: <p>Specifies whether automatic retraining should be attempted for the versions of the project. Automatic retraining is done as a best effort. Required argument for Content Moderation. Applicable only to adapters.</p>
tags: <p>A set of tags (key-value pairs) that you want to attach to the project.</p>
Raises:
capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
capo_rekognition.errors.limit_exceeded_exception.LimitExceededException: <p>An Amazon Rekognition service limit was exceeded. For example, if you start too many jobs concurrently, subsequent calls to start operations (ex: <code>StartLabelDetection</code>) will raise a <code>LimitExceededException</code> exception (HTTP status code: 400) until the number of concurrently running jobs is below the Amazon Rekognition service limit. </p>
capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
capo_rekognition.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is already being used.</p>
capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To create an Amazon Rekognition Custom Labels project
Creates an Amazon Rekognition Custom Labels project.
>>> client.create_project(project_name='my-project')
"""
def _handler(
req: "OperationRequest[capo_rekognition.types.create_project_request.CreateProjectRequest]",
) -> OperationResponse[
"capo_rekognition.types.create_project_response.CreateProjectResponse"
]:
import capo_rekognition._operations.rekognition_service.create_project
output, http_response = (
capo_rekognition._operations.rekognition_service.create_project.create_project(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateProject")
)
input_: capo_rekognition.types.create_project_request.CreateProjectRequest = {
"project_name": project_name
}
if feature is not None:
input_["feature"] = feature
if auto_update is not None:
input_["auto_update"] = auto_update
if tags is not None:
input_["tags"] = tags
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|