예제 #1
0
        static void Main(string[] args)
        {
            List <EvaluationData> evaluationData = new List <EvaluationData>();

            // Create an instance of the Content Moderator API wrapper.
            using (var client = Clients.NewClient())
            {
                EvaluationData imageData = EvaluateImage(client, SampleImage1);
                evaluationData.Add(imageData);
                imageData = EvaluateImage(client, SampleImage2);
                evaluationData.Add(imageData);
            }
            Console.WriteLine(JsonConvert.SerializeObject(
                                  evaluationData, Formatting.Indented));
            Console.ReadLine();
        }
예제 #2
0
        private static EvaluationData EvaluateImage(ContentModeratorClient client, string imageUrl)
        {
            var url = new BodyModel("URL", imageUrl.Trim());

            var imageData = new EvaluationData();

            imageData.ImageUrl = url.Value;

            imageData.ImageModeration =
                client.ImageModeration.EvaluateUrlInput("application/json", url, true);
            Thread.Sleep(1000);

            imageData.TextDetection =
                client.ImageModeration.OCRUrlInput("eng", "application/json", url, true);
            Thread.Sleep(1000);

            imageData.FaceDetection =
                client.ImageModeration.FindFacesUrlInput("application/json", url, true);
            Thread.Sleep(1000);

            return(imageData);
        }