将 GetCelebrityInfo 与 AWS SDK 或 CLI 配合使用 - AWS SDK 代码示例

AWS 文档 SDK 示例 GitHub 存储库中还有更多 AWS SDK 示例。

GetCelebrityInfo 与 AWS SDK 或 CLI 配合使用

以下代码示例演示如何使用 GetCelebrityInfo

.NET
适用于 .NET 的 SDK
注意

查看 GitHub,了解更多信息。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

using System; using System.Threading.Tasks; using Amazon.Rekognition; using Amazon.Rekognition.Model; /// <summary> /// Shows how to use Amazon Rekognition to retrieve information about the /// celebrity identified by the supplied celebrity Id. /// </summary> public class CelebrityInfo { public static async Task Main() { string celebId = "nnnnnnnn"; var rekognitionClient = new AmazonRekognitionClient(); var celebrityInfoRequest = new GetCelebrityInfoRequest { Id = celebId, }; Console.WriteLine($"Getting information for celebrity: {celebId}"); var celebrityInfoResponse = await rekognitionClient.GetCelebrityInfoAsync(celebrityInfoRequest); // Display celebrity information. Console.WriteLine($"celebrity name: {celebrityInfoResponse.Name}"); Console.WriteLine("Further information (if available):"); celebrityInfoResponse.Urls.ForEach(url => { Console.WriteLine(url); }); } }
  • 有关 API 的详细信息,请参阅《适用于 .NET 的 AWS SDK API Reference》中的 GetCelebrityInfo

CLI
AWS CLI

获取有关名人的信息

以下 get-celebrity-info 命令显示有关指定名人的信息:id 参数来自先前对 recognize-celebrities 的调用。

aws rekognition get-celebrity-info --id nnnnnnn

输出:

{ "Name": "Celeb A", "Urls": [ "www.imdb.com/name/aaaaaaaaa" ] }

有关更多信息,请参阅《Amazon Rekognition 开发人员指南》中的获取有关名人的信息

  • 有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 GetCelebrityInfo