Amazon Rekognition
Developer Guide

Getting Information about a Celebrity

In these procedures, you get celebrity information by using the GetCelebrityInfo API operation. The celebrity is identified by using the celebrity ID returned from a previous call to RecognizeCelebrities.


To run these procedures, you need to have the AWS CLI and AWS SDK for Java installed. For more information, see Getting Started with Amazon Rekognition. The AWS account you use must have access permissions to the Amazon Rekognition API. For more information, see Amazon Rekognition API Permissions: Actions, Permissions, and Resources Reference.

These procedures also require the celebrity ID for a celebrity that Rekognition knows. Use the celebrity ID you note in Recognizing Celebrities in an Image.

To get celebrity information (AWS CLI)

  1. On the command line, type the following command. Replace ID with one of the celebrity IDs displayed in Recognizing Celebrities in an Image.

    aws rekognition get-celebrity-info --id ID
  2. To run the command, choose Enter. The JSON output for the GetCelebrityInfo API operation is displayed.

To get celebrity information (SDK)

  1. Use the following AWS SDK for Java example code to get information about a celebrity that Amazon Rekognition recognized in an image. Replace ID with one of the celebrity IDs displayed in Recognizing Celebrities in an Image.

    import com.amazonaws.AmazonClientException; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.regions.Regions; import; import; import; import; public class CelebrityInfo { public static void main(String[] args) { String id = "ID"; AWSCredentials credentials; try { credentials = new ProfileCredentialsProvider("AdminUser").getCredentials(); } catch (Exception e) { throw new AmazonClientException("Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (/Users/userid>.aws/credentials), and is in valid format.", e); } AmazonRekognition amazonRekognition = AmazonRekognitionClientBuilder .standard() .withRegion(Regions.US_WEST_2) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); GetCelebrityInfoRequest request = new GetCelebrityInfoRequest() .withId(id); System.out.println("Getting information for celebrity: " + id); GetCelebrityInfoResult result=amazonRekognition.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); } } }
  2. Run the example code. The celebrity name and information about the celebrity, if it is available, is displayed.

On this page: