

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# SageMaker API を使用してストリーミングラベル付けジョブを作成する
<a name="sms-streaming-create-labeling-job-api"></a>

以下は、米国東部 (バージニア北部) リージョンで、組み込みタスクタイプのラベル付けジョブを開始するのに使用できる [AWS Python SDK (Boto3) リクエスト](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sagemaker.html#SageMaker.Client.create_labeling_job)の例です。以下の各パラメータの詳細については、「[https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html)」を参照してください。この API と関連する言語固有の SDK を使用してラベル付けジョブを作成する方法については、「[ラベル付けジョブを作成する (API)](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-create-labeling-job-api.html)」を参照してください。

この例では、以下のパラメータに注意します。
+ `SnsDataSource`- このパラメータは、`InputConfig` と `OutputConfig` に表示され、Amazon SNS トピックの入力と出力をそれぞれ特定するために使用されます。ストリーミングラベル付けジョブを作成するには、Amazon SNS 入力トピックを指定する必要があります。必要に応じて、Amazon SNS 出力トピックも指定できます。
+ `S3DataSource` - このパラメータはオプションです。ラベル付けジョブの開始と同時にラベル付けするデータオブジェクトの入力マニフェストファイルを含める場合は、このパラメータを使用します。
+ [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-StoppingConditions](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-StoppingConditions) — ストリーミングラベル付けジョブを作成する場合、このパラメータは無視されます。ストリーミングラベル付けジョブの停止の詳細については、「[ストリーミングラベル付けジョブを停止する](sms-streaming-stop-labeling-job.md)」を参照してください。
+ ストリーミングラベル付けジョブは、自動データラベリングをサポートしていません。`LabelingJobAlgorithmsConfig` パラメータは含めないでください。

```
response = client.create_labeling_job(
    LabelingJobName= '{{example-labeling-job}}',
    LabelAttributeName='label',
    InputConfig={
        'DataSource': {
            'S3DataSource': {
                'ManifestS3Uri': '{{s3://bucket/path/manifest-with-input-data.json}}'
            },
            'SnsDataSource': {
                'SnsTopicArn': '{{arn:aws:sns:us-east-1:123456789012:your-sns-input-topic}}'
            }
        },
        'DataAttributes': {
            'ContentClassifiers': [
                'FreeOfPersonallyIdentifiableInformation'|'FreeOfAdultContent',
            ]
        }
    },
    OutputConfig={
        'S3OutputPath': '{{s3://bucket/path/file-to-store-output-data}}',
        'KmsKeyId': 'string',
        'SnsTopicArn': '{{arn:aws:sns:us-east-1:123456789012:your-sns-output-topic}}'
    },
    RoleArn='{{arn:aws:iam::*:role/*}}',
    LabelCategoryConfigS3Uri='{{s3://bucket/path/label-categories.json}}',
    HumanTaskConfig={
        'WorkteamArn': '{{arn:aws:sagemaker:us-east-1:*:workteam/private-crowd/*}}',
        'UiConfig': {
            'UiTemplateS3Uri': '{{s3://bucket/path/custom-worker-task-template.html}}'
        },
        'PreHumanTaskLambdaArn': 'arn:aws:lambda:us-east-1:432418664414:function:PRE-{{tasktype}}',
        'TaskKeywords': [
            '{{Example key word}}',
        ],
        'TaskTitle': '{{Multi-label image classification task}}',
        'TaskDescription': '{{Select all labels that apply to the images shown}}',
        'NumberOfHumanWorkersPerDataObject': {{123}},
        'TaskTimeLimitInSeconds': {{123}},
        'TaskAvailabilityLifetimeInSeconds': {{123}},
        'MaxConcurrentTaskCount': {{123}},
        'AnnotationConsolidationConfig': {
            'AnnotationConsolidationLambdaArn': 'arn:aws:lambda:us-east-1:432418664414:function:ACS-{{tasktype}}'
            }
        },
    Tags=[
        {
            'Key': '{{string'}},
            'Value': '{{string}}'
        },
    ]
)
```