Azure-Samples / cognitive-services-quickstart-code

Code Examples used by the Quickstarts in the Cognitive Services Documentation
MIT License
351 stars 518 forks source link

New Face Quickstart Code Samples for C# Python JavaScript #369

Closed der3318 closed 2 months ago

der3318 commented 2 months ago

Purpose

The PR rewrites all the face sample codes that are referenced by learn.microsoft.com. The primary goal is to migrate to the newly released SDKs:

Language Deprecated SDK New SDK
C# Microsoft.Azure.CognitiveServices.Vision.Face Azure.AI.Vision.Face
Python azure-cognitiveservices-vision-face azure.ai.vision.face
JavaScript @azure/cognitiveservices-face @azure-rest/ai-vision-face

[!NOTE]
Some of the operations (e.g., collection management) are not fully supported by the current version of FaceClient. For those cases, we fallback to raw REST APIs invoked via HttpClient (C#) and module requests (Python).

File Rewritten Based on Referenced by
dotnet/Face/Quickstart.cs FaceQuickstart-single.cs identity-csharp-sdk.md
dotnet/Face/Detect.cs detect.cs identity-detect-faces.md
dotnet/Face/FindSimilar.cs FaceQuickstart.cs find-similar-faces.md
python/Face/Quickstart.py FaceQuickstart-single.py identity-python-sdk.md
javascript/Face/Quickstart.js sdk_quickstart_cognitiveservices-face.js identity-javascript-sdk.md

There're also some minor fixes and unification between languages:

Console.WriteLine("Pausing for 60 seconds to avoid triggering rate limit on free account...");
await Task.Delay(60000);

Does this introduce a breaking change?

Pull Request Type

What kind of change does this Pull Request introduce?

How to Test

Visual Studio 2022 | .NET 8.0 (LTS)

$ dotnet run

Python 3.8.9

$ python Quickstart.py

OpenJS.NodeJS.LTS (Version 20.15.0)

$ node Quickstart.js

Other Information

Related changes but are covered by the PR:

Here are the planned TODOs:

der3318 commented 2 months ago

@PatrickFarley , please help check the new samples in. I will continue to work on docs changes and create another PR in repo azure-docs-pr for you to have a comprehensive review. Thanks!