1+ // <snippet_imports>
12import com .google .gson .*;
23
34import com .microsoft .azure .cognitiveservices .vision .contentmoderator .*;
67import java .io .*;
78import java .lang .Object .*;
89import java .util .*;
10+ // </snippet_imports>
911
1012/**
1113 * 1. Obtain Azure Face resource
2224
2325public class ContentModeratorQuickstart {
2426
27+ // <snippet_evaluationdata>
2528 // Contains the image moderation results for an image, including text and face detection.
2629 public static class EvaluationData {
2730 // The URL of the evaluated image.
@@ -33,17 +36,21 @@ public static class EvaluationData {
3336 // The face detection results;
3437 public FoundFaces FaceDetection ;
3538 }
39+ // </snippet_evaluationdata>
3640
3741 public static void main (String [] args ) {
42+ // <snippet_client>
3843 /**
3944 * Authenticate
4045 */
4146 // Create a variable called AZURE_CONTENTMODERATOR_KEY in your environment settings, with your key as its value.
42- // Replace the region ( westus) with your own, if needed.
47+ // Replace the first part (" westus" ) with your own, if needed.
4348 ContentModeratorClient client = ContentModeratorManager
4449 .authenticate (new AzureRegionBaseUrl ()
4550 .fromString ("https://westus.api.cognitive.microsoft.com" ), System .getenv ("AZURE_CONTENTMODERATOR_KEY" ));
46-
51+ // </snippet_client>
52+
53+ // <snippet_imagemod>
4754 // Create an object in which to store the image moderation results.
4855 List <EvaluationData > evaluationData = new ArrayList <EvaluationData >();
4956
@@ -92,6 +99,7 @@ public static void main(String[] args) {
9299 System .out .println (e .getMessage ());
93100 e .printStackTrace ();
94101 }
102+ // </snippet_imagemod>
95103 }
96104}
97105// END - Moderate Image with URL images in a file
0 commit comments