spinning off Sagemaker Ground Truth Labelling hosted UI with boto3

0

Hi all!

I would like to kindly ask how to spin off Sagemaker Ground Truth hosted labelling UI https://XXX.labeling.REGION.sagemaker.aws with boto3? With the hosted labelling UI, I could create a Cognito App that would allow the private workforce team to be authenticated and to perform labelling.

Creating Private workforce from Sagemaker console creates a Cognito user pool and the App client automatically. The App is accessible under the URL https://XXX.labeling.REGION.sagemaker.aws and allows to perform the labelling. https://XXX.labeling.REGION.sagemaker.aws/oauth2/idpresponse is being set as an allowed callback URL as well as https://YYY.cloudfront.net. Allowed sign-out URL is being set as https://XXX.labeling.us-east-1.sagemaker.aws/logout.

Btw. why is it necessary to set https://YYY.cloudfront.net as a callback?

Thank you very much for you support,

1개 답변
0

Install and configure boto3 if you haven't done so already. Use the create_labeling_job function from the SageMaker client in boto3. Pass necessary parameters like HumanTaskConfig, InputConfig, and OutputConfig containing information about the labeling workforce, input data location, and output data location.

import boto3

sagemaker_client = boto3.client('sagemaker')

response = sagemaker_client.create_labeling_job(
    LabelingJobName='your-labeling-job-name',
    LabelAttributeName='your-label-attribute-name',
    InputConfig={
        'DataSource': {
            'S3DataSource': {
                'ManifestS3Uri': 's3://your-input-data-bucket/your-manifest-file.manifest'
            }
        },
        'DataAttributes': {
            'ContentClassifiers': [
                'FreeOfPersonallyIdentifiableInformation',
                'FreeOfAdultContent',
            ]
        }
    },
    OutputConfig={
        'S3OutputPath': 's3://your-output-data-bucket/'
    },
    RoleArn='your-sagemaker-execution-role-arn',
    HumanTaskConfig={
        'WorkteamArn': 'your-workteam-arn',
        'UiConfig': {
            'UiTemplateS3Uri': 's3://your-ui-template-bucket/your-ui-template.zip'
        },
        'PreHumanTaskLambdaArn': 'your-pre-human-task-lambda-arn',
        'TaskKeywords': ['your-task-keyword'],
        'TaskTitle': 'Your Task Title',
        'TaskDescription': 'Your Task Description',
        'NumberOfHumanWorkersPerDataObject': 1,
        'TaskTimeLimitInSeconds': 600,
        'TaskAvailabilityLifetimeInSeconds': 86400,
        'MaxConcurrentTaskCount': 10,
        'AnnotationConsolidationConfig': {
            'AnnotationConsolidationLambdaArn': 'your-annotation-consolidation-lambda-arn'
        }
    }
)
profile picture
전문가
답변함 일 년 전
  • To create a labelling job, WorkteamArn is required. To create a Work Team, CognitoMemberDefinition (with UserPool, UserGroup, and ClientId) is required. To create a user pool with client App, callback URLs (i.e., https://XXX.labeling.REGION.sagemaker.aws and possibly https://YYY.cloudfront.net) are required. My question is, how to spin off https://XXX.labeling.REGION.sagemaker.aws? What does https://YYY.cloudfront.net do?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인