1
votes

API Name:

TextModerator

have Azure Subscription and I created the cognitive service, and from a c# console, I'm trying to test the TextModerator project.

When this line is called:

var screenResult =
                        client.TextModeration.ScreenText("text/plain", new MemoryStream(Encoding.UTF8.GetBytes(text)), "eng", true, true, null, true);

I got the following message:

Microsoft.CognitiveServices.ContentModerator.Models.APIErrorException : 'Operation returned an invalid status code 'NotFound''

the endpoint is like this:

https://contentmoderator-****.cognitiveservices.azure.com/contentmoderator

Any Idea?

Saad

1

1 Answers

1
votes

You can use the following base endpoint for your specific Region(ex:westus). https://westus.api.cognitive.microsoft.com.

Install the client library: Within the application directory, install the Content Moderator client library for .NET with the following command:

dotnet add package Microsoft.Azure.CognitiveServices.ContentModerator --version 2.0.0

If you're using the Visual Studio IDE, the client library is available as a downloadable NuGet package.

Please follow the below document for Moderate Text. https://docs.microsoft.com/en-us/azure/cognitive-services/content-moderator/dotnet-sdk-quickstart#setting-up

enter image description here

Please follow the API Reference for more information.