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 réponse
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
EXPERT
répondu il y a un an
  • 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?

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions