You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/content-safety/concepts/custom-categories.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,23 +14,23 @@ ms.author: pafarley
14
14
15
15
# Custom categories
16
16
17
-
The Azure AI Content Safety Custom Category feature lets you create and manage your own content categories for enhanced moderation and filtering. This feature enables customers to define categories specific to their needs, provide sample data, train a custom machine learning model, and use it to classify new content according to the predefined categories.
17
+
The Azure AI Content Safety custom category feature lets you create and manage your own content categories for enhanced moderation and filtering. This feature enables customers to define categories specific to their needs, provide sample data, train a custom machine learning model, and use it to classify new content according to the predefined categories.
18
18
19
19
## Types of analysis
20
20
21
21
| API | Functionality |
22
22
| :--------- | :------------ |
23
-
| Customized categories | Create, get, and delete a customized category or list all customized categories for further annotation task|
23
+
| Customized categories | Create, get, and delete a customized category or list all customized categories for further annotation tasks|
24
24
25
25
## How it works
26
26
27
-
The Azure AI Content Safety Custom Category feature provides a streamlined process for creating, training, and using custom content classification models. Here's an in-depth look at the underlying workflow:
27
+
The Azure AI Content Safety custom category feature provides a streamlined process for creating, training, and using custom content classification models. Here's a look at the underlying workflow:
28
28
29
29
### Step 1: Definition and setup
30
30
31
31
When you define a custom category, you need to teach the AI what type of content you want to identify. This involves providing a clear **category name** and a detailed **definition** that encapsulates the content's characteristics.
32
32
33
-
Then, you collect a balanced dataset with **positive** and (optionally)**negative examples** to help the AI to learn the nuances of your category. This data should be representative of the variety of content that the model will encounter in a real-world scenario.
33
+
Then, you collect a balanced dataset with **positive** and (optionally)**negative examples** to help the AI to learn the nuances of your category. This data should be representative of the variety of content that the model will encounter in a real-world scenario.
34
34
35
35
### Step 2: Model training
36
36
@@ -44,6 +44,8 @@ After training, you need to evaluate the model to ensure it meets your accuracy
44
44
45
45
### Input limitations
46
46
47
+
See the following table for the input limitations of the service.
48
+
47
49
| Object | Limitation |
48
50
| ---------------- | ------------ |
49
51
| Supported languages | English only |
@@ -60,6 +62,11 @@ After training, you need to evaluate the model to ensure it meets your accuracy
60
62
| Length of a blob url | maximum 500 characters |
61
63
62
64
65
+
### Region availability
66
+
67
+
To use this API, you must create your Azure AI Content Safety resource in one of the supported regions:
Copy file name to clipboardExpand all lines: articles/ai-services/content-safety/concepts/incident-response.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,9 @@ One way to deal with emerging content incidents is to use [Blocklists](/azure/ai
26
26
27
27
## How it works
28
28
29
-
First, you create an incident object with a description. Then you add any number of image or text samples to the incident. The service will analyze the description and samples right away: no training step is needed.
29
+
First, you use the API to create an incident object with a description. Then you add any number of image or text samples to the incident. No training step is needed.
30
30
31
-
Then, you can include your defined incident in a regular text analysis or image analysis request. The service will return whether the submitted content is an instance of your incident. The service can still do other content moderation tasks in the same API call.
31
+
Then, you can include your defined incident in a regular text analysis or image analysis request. The service will indicate whether the submitted content is an instance of your incident. The service can still do other content moderation tasks in the same API call.
Copy file name to clipboardExpand all lines: articles/ai-services/content-safety/how-to/custom-categories.md
+29-15Lines changed: 29 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,9 @@ The custom category API lets you create your own content categories for your use
26
26
## Prerequisites
27
27
28
28
* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
29
-
* Once you have your Azure subscription, <ahref="https://aka.ms/acs-create"title="Create a Content Safety resource"target="_blank">create a Content Safety resource</a> in the Azure portal to get your key and endpoint. Enter a unique name for your resource, select your subscription, and select a resource group, supported region (East US), and supported pricing tier. Then select **Create**.
29
+
* Once you have your Azure subscription, <ahref="https://aka.ms/acs-create"title="Create a Content Safety resource"target="_blank">create a Content Safety resource</a> in the Azure portal to get your key and endpoint. Enter a unique name for your resource, select your subscription, and select a resource group, supported region (East US), and supported pricing tier. Then select **Create**.
30
30
* The resource takes a few minutes to deploy. After it finishes, Select **go to resource**. In the left pane, under **Resource Management**, select **Subscription Key and Endpoint**. Copy the endpoint and either of the key values to a temporary location for later use.
31
-
* Also create an Azure blob storage container where you'll keep your training annotation file.
31
+
* Also [create an Azure blob storage container](https://ms.portal.azure.com/#create/Microsoft.StorageAccount-ARM) where you'll keep your training annotation file.
32
32
* One of the following installed:
33
33
*[cURL](https://curl.haxx.se/) for REST API calls.
34
34
*[Python 3.x](https://www.python.org/) installed
@@ -39,7 +39,7 @@ The custom category API lets you create your own content categories for your use
39
39
40
40
To train a custom category, you need example text data that represents the category you want to detect. Follow these steps to prepare your sample data:
41
41
42
-
1. Collect or write sample data.
42
+
1. Collect or write your sample data:
43
43
- The quality of your sample data is important for training an effective model. Aim to collect at least 50 positive samples that accurately represent the content you want to identify. These samples should be clear, varied, and directly related to the category definition.
44
44
- Negative samples aren't required, but they can improve the model's ability to distinguish relevant content from irrelevant content.
45
45
To improve performance, aim for 50 samples that aren't related to the positive case definition. These should be varied but still within the context of the content your model will encounter. Choose negative samples carefully to ensure they don't inadvertently overlap with the positive category.
@@ -52,7 +52,7 @@ To train a custom category, you need example text data that represents the categ
52
52
{"text": "This is the 3rd sample (negative).", "isPositive": false}
53
53
```
54
54
55
-
1. Upload the _.jsonl_ file to an Azure Storage account blob container. You can create a new [Azure Storage Account](https://ms.portal.azure.com/#create/Microsoft.StorageAccount-ARM) if you don't have one. Copy the blob URL to a temporary location for later use.
55
+
1. Upload the _.jsonl_ file to an Azure Storage account blob container. Copy the blob URL to a temporary location for later use.
56
56
57
57
### Grant storage access
58
58
@@ -70,7 +70,7 @@ To train a custom category, you need example text data that represents the categ
70
70
71
71
#### [cURL](#tab/curl)
72
72
73
-
In the commands below, replace `<your_api_key>`, `<your_endpoint>`, and other necessary parameters with your own values:
73
+
In the commands below, replace `<your_api_key>`, `<your_endpoint>`, and other necessary parameters with your own values. Then enter each command in a terminal window and run it.
74
74
75
75
### Create new category version
76
76
@@ -93,7 +93,9 @@ curl -X POST "<endpoint>/contentsafety/text/categories/<your_category_name>:buil
93
93
-H "Content-Type: application/json"
94
94
```
95
95
96
-
## Analyze text with a customized category:
96
+
## Analyze text with a customized category
97
+
98
+
Run the following command to analyze text with your customized category. Replace `<your_category_name>` with your own value:
97
99
98
100
```bash
99
101
curl -X POST "<endpoint>/contentsafety/text:analyzeCustomCategory?api-version=2024-02-15-preview" \
@@ -115,7 +117,7 @@ First, you need to install the required Python library:
115
117
pip install requests
116
118
```
117
119
118
-
Then, define the necessary variables with your own Azure resource details:
120
+
Then, open a new Python script and define the necessary variables with your own Azure resource details:
Remember to replace the placeholders with your actual values for the API key, endpoint, and specific content (category name, definition, and so on). These examples help you get started using Azure AI Content Safety to analyze your text and work with customized categories.
205
+
Remember to replace the placeholders below with your actual values for the API key, endpoint, and specific content (category name, definition, and so on). These examples help you to manage the customized categories in your account.
204
206
205
207
#### [cURL](#tab/curl)
206
208
207
-
### Get a customized category or a specific version of it:
209
+
### Get a customized category or a specific version of it
210
+
211
+
Replace the placeholders with your own values and run the following command in a terminal window:
208
212
209
213
```bash
210
214
curl -X GET "<endpoint>/contentsafety/text/categories/<your_category_name>?api-version=2024-02-15-preview&version=1" \
@@ -214,6 +218,8 @@ curl -X GET "<endpoint>/contentsafety/text/categories/<your_category_name>?api-v
214
218
215
219
### List categories of their latest versions
216
220
221
+
Replace the placeholders with your own values and run the following command in a terminal window:
222
+
217
223
```bash
218
224
curl -X GET "<endpoint>/contentsafety/text/categories?api-version=2024-02-15-preview" \
219
225
-H "Ocp-Apim-Subscription-Key: <your_api_key>" \
@@ -222,6 +228,8 @@ curl -X GET "<endpoint>/contentsafety/text/categories?api-version=2024-02-15-pre
222
228
223
229
### Delete a customized category or a specific version of it
224
230
231
+
Replace the placeholders with your own values and run the following command in a terminal window:
0 commit comments