기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
유명 인사에 대한 정보 얻기
이 절차에서는 getCelebrityInfo API 작업을 사용하여 유명 인사 정보를 얻습니다. 유명 인사는 이전 RecognizeCelebrities 직접 호출에서 반환된 유명 인사 ID를 사용하여 식별됩니다.
GetCelebrityInfo 호출
            
            이 절차에는 Amazon Rekognition이 알고 있는 유명 인사의 유명 인사 ID가 필요합니다. 이미지 속 유명 인사 인식에서 기록해둔 유명 인사 ID를 사용합니다.
        유명 인사 정보를 획득하려면(SDK)
아직 설정하지 않았다면 다음과 같이 하세요.
                AmazonRekognitionFullAccess 권한과 AmazonS3ReadOnlyAccess 권한을 가진 사용자를 생성하거나 업데이트합니다. 자세한 내용은 1단계: AWS 계정 설정 및 사용자 생성 단원을 참조하십시오.
 AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 내용은 2단계: AWS CLI 및 AWS SDKs 설정 단원을 참조하십시오.
            다음 예제를 사용하여 GetCelebrityInfo 작업을 호출합니다.
                
                 - Java
 이 예제는 유명 인사의 이름과 정보를 표시합니다.
                         id를 이미지 속 유명 인사 인식에 표시된 유명 인사 ID 중 하나로 바꿉니다.
                            //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
package aws.example.rekognition.image;
import com.amazonaws.services.rekognition.AmazonRekognition;
import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder;
import com.amazonaws.services.rekognition.model.GetCelebrityInfoRequest;
import com.amazonaws.services.rekognition.model.GetCelebrityInfoResult;
public class CelebrityInfo {
   public static void main(String[] args) {
      String id = "nnnnnnnn";
      AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();
      GetCelebrityInfoRequest request = new GetCelebrityInfoRequest()
         .withId(id);
      System.out.println("Getting information for celebrity: " + id);
      GetCelebrityInfoResult result=rekognitionClient.getCelebrityInfo(request);
      //Display celebrity information
      System.out.println("celebrity name: " + result.getName());
      System.out.println("Further information (if available):");
      for (String url: result.getUrls()){
         System.out.println(url);
      }
   }
}
      
                           
                    - Java V2
 - 
                            
이 코드는 AWS 설명서 SDK 예제 GitHub 리포지토리에서 가져온 것입니다. 전체 예제는 여기에서 확인하세요.
                            import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.rekognition.RekognitionClient;
import software.amazon.awssdk.services.rekognition.model.GetCelebrityInfoRequest;
import software.amazon.awssdk.services.rekognition.model.GetCelebrityInfoResponse;
import software.amazon.awssdk.services.rekognition.model.RekognitionException;
/**
 * Before running this Java V2 code example, set up your development
 * environment, including your credentials.
 *
 * For more information, see the following documentation topic:
 *
 * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
 */
public class CelebrityInfo {
    public static void main(String[] args) {
        final String usage = """
                Usage:    <id>
                Where:
                   id - The id value of the celebrity. You can use the RecognizeCelebrities example to get the ID value.\s
                """;
        if (args.length != 1) {
            System.out.println(usage);
            System.exit(1);
        }
        String id = args[0];
        Region region = Region.US_WEST_2;
        RekognitionClient rekClient = RekognitionClient.builder()
                .region(region)
                .build();
        getCelebrityInfo(rekClient, id);
        rekClient.close();
    }
    /**
     * Retrieves information about a celebrity identified in an image.
     *
     * @param rekClient the Amazon Rekognition client used to make the API call
     * @param id the unique identifier of the celebrity
     * @throws RekognitionException if there is an error retrieving the celebrity information
     */
    public static void getCelebrityInfo(RekognitionClient rekClient, String id) {
        try {
            GetCelebrityInfoRequest info = GetCelebrityInfoRequest.builder()
                    .id(id)
                    .build();
            GetCelebrityInfoResponse response = rekClient.getCelebrityInfo(info);
            System.out.println("celebrity name: " + response.name());
            System.out.println("Further information (if available):");
            for (String url : response.urls()) {
                System.out.println(url);
            }
        } catch (RekognitionException e) {
            System.out.println(e.getMessage());
            System.exit(1);
        }
    }
}
                         
                - AWS CLI
 - 
                            
이 AWS CLI 명령은 get-celebrity-info CLI 작업에 대한 JSON 출력을 표시합니다. ID를 이미지 속 유명 인사 인식에 표시된 유명 인사 ID 중 하나로 바꿉니다. profile-name의 값을 개발자 프로필 이름으로 바꿉니다.
                            aws rekognition get-celebrity-info --id celebrity-id --profile profile-name
                         
                    - Python
 이 예제는 유명 인사의 이름과 정보를 표시합니다.
                            id를 이미지 속 유명 인사 인식에 표시된 유명 인사 ID 중 하나로 바꿉니다. Rekognition 세션을 생성하는 라인에서 profile_name의 값을 개발자 프로필의 이름으로 대체합니다.
                            # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
import boto3
def get_celebrity_info(id):
    session = boto3.Session(profile_name='profile-name')
    client = session.client('rekognition')
    # Display celebrity info
    print('Getting celebrity info for celebrity: ' + id)
    response = client.get_celebrity_info(Id=id)
    print(response['Name'])
    print('Further information (if available):')
    for url in response['Urls']:
        print(url)
def main():
    id = "celebrity-id"
    celebrity_info = get_celebrity_info(id)
if __name__ == "__main__":
    main()
                         
                    - .NET
 이 예제는 유명 인사의 이름과 정보를 표시합니다.
                            id를 이미지 속 유명 인사 인식에 표시된 유명 인사 ID 중 하나로 바꿉니다.
                            //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
using System;
using Amazon.Rekognition;
using Amazon.Rekognition.Model;
public class CelebrityInfo
{
    public static void Example()
    {
        String id = "nnnnnnnn";
        AmazonRekognitionClient rekognitionClient = new AmazonRekognitionClient();
        GetCelebrityInfoRequest celebrityInfoRequest = new GetCelebrityInfoRequest()
        {
            Id = id
        };
        Console.WriteLine("Getting information for celebrity: " + id);
        GetCelebrityInfoResponse celebrityInfoResponse = rekognitionClient.GetCelebrityInfo(celebrityInfoRequest);
        //Display celebrity information
        Console.WriteLine("celebrity name: " + celebrityInfoResponse.Name);
        Console.WriteLine("Further information (if available):");
        foreach (String url in celebrityInfoResponse.Urls)
            Console.WriteLine(url);
    }
}
                         
                
            
 
            GetCelebrityInfo 작업 요청
            다음은 GetCelebrityInfo에 대한 예제 JSON 입력 및 출력입니다.
            GetCelebrityInfo에 대한 입력은 해당 유명 인사의 ID입니다.
            {
    "Id": "nnnnnnn"
}
         
            GetCelebrityInfo 작업 응답
            
            
            
            
            GetCelebrityInfo는 요청한 유명 인사의 정보에 대한 링크 배열(Urls)을 반환합니다.
            {
    "Name": "Celebrity Name",
    "Urls": [
        "www.imdb.com/name/nmnnnnnnn"
    ]
}