Skip to content

Commit 3a84dfb

Browse files
Merge pull request #32 from Azure-Samples/conmod-updates
add snippet tags
2 parents 8426e26 + 33e1d70 commit 3a84dfb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ContentModerator/ContentModeratorQuickstart/src/main/java/ContentModeratorQuickstart.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// <snippet_imports>
12
import com.google.gson.*;
23

34
import com.microsoft.azure.cognitiveservices.vision.contentmoderator.*;
@@ -6,6 +7,7 @@
67
import java.io.*;
78
import java.lang.Object.*;
89
import java.util.*;
10+
// </snippet_imports>
911

1012
/**
1113
* 1. Obtain Azure Face resource
@@ -22,6 +24,7 @@
2224

2325
public 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

Comments
 (0)