Skip to content

Commit 8c9d8cd

Browse files
committed
import harper's drafts
1 parent 620cbe8 commit 8c9d8cd

File tree

5 files changed

+786
-0
lines changed

5 files changed

+786
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Content safety containers overview - Azure AI Content Safety
3+
titleSuffix: Azure AI services
4+
description: Use the Docker containers for the content safety service to perform content safety check on-premises.
5+
author:
6+
manager:
7+
ms.service: azure-ai-content-safety
8+
ms.topic:
9+
ms.date:
10+
ms.author:
11+
keywords: on-premises, Docker, container
12+
---
13+
14+
# Content Safety containers overview
15+
16+
By using containers, you can use a subset of the content safety service features in your own environment. With content safety containers, you can build a content safety application architecture optimized for both robust cloud capabilities and edge locality. Containers are great for specific security and data governance requirements.
17+
18+
## Available content safety containers
19+
20+
The following table lists the content safety containers available in the Microsoft Container Registry (MCR). The table also lists the features supported by each container and the latest version of the container.
21+
22+
| Container | Features |
23+
|--------------------------------------|----------|
24+
|Analyze text|Scans text for sexual content, violence, hate, and self harm with multi-severity levels.|
25+
|Analyze image|Scans images for sexual content, violence, hate, and self harm with multi-severity levels.|
26+
27+
The content safety container is available in public preview. Containers in preview are still under development and don't meet Microsoft's stability and support requirements.
28+
29+
## Request approval to run containers disconnected from the internet
30+
31+
To use the content safety containers in environments that are disconnected from the internet, you must submit a [request form](https://aka.ms/csdisconnectedcontainers) and wait for approval. For more information about applying and purchasing a commitment plan to use containers in disconnected environments, see [Use containers in disconnected environments](../../ai-services/containers/disconnected-containers.md) in the Azure AI services documentation.
32+
33+
The form requests information about you, your company, and the user scenario for which you use the container.
34+
35+
* On the form, you must use an email address associated with an Azure subscription ID.
36+
* The Azure resource you use to run the container must be created with the approved Azure subscription ID.
37+
* Check your email for updates on the status of your application from Microsoft.
38+
39+
After you submit the form, the Azure AI services team reviews it and emails you with a decision within 10 business days.
40+
41+
## Billing
42+
43+
The content safety containers send billing information to Azure by using a content safety resource on your Azure account.
44+
45+
> [!NOTE]
46+
> Connected and disconnected container pricing and commitment tiers vary. For more information, see [content safety service pricing](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/content-safety/).
47+
48+
Content safety containers aren't licensed to run without being connected to Azure for metering. You must configure your container to always communicate billing information with the metering service. For more information, see [billing arguments](content safety-container-howto.md#billing-arguments).
49+
50+
## Container recipes and other container services
51+
52+
You can use container recipes to create containers that can be reused. Containers can be built with some or all configuration settings so that they aren't needed when the container is started. For container recipes see the following Azure AI services articles:
53+
- [Create containers for reuse](../containers/container-reuse-recipe.md)
54+
- [Deploy and run container on Azure Container Instance](../containers/azure-container-instance-recipe.md)
55+
- [Deploy a language detection container to Azure Kubernetes Service](../containers/azure-kubernetes-recipe.md)
56+
- [Use Docker Compose to deploy multiple containers](../containers/docker-compose-recipe.md)
57+
58+
For information about other container services, see the following Azure AI services articles:
59+
- [Tutorial: Create a container image for deployment to Azure Container Instances](/azure/container-instances/container-instances-tutorial-prepare-app)
60+
- [Quickstart: Create a private container registry using the Azure CLI](/azure/container-registry/container-registry-get-started-azure-cli)
61+
- [Tutorial: Prepare an application for Azure Kubernetes Service (AKS)](/azure/aks/tutorial-kubernetes-prepare-app)
62+
63+
## Next steps
64+
65+
* [Install and run analyze text containers](./analyze-text-container.md)
66+
[Install and run analyze image containers](./analyze-image-container.md)
67+
68+
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
title: Analyze image container - Azure AI content safety
3+
titleSuffix: Azure AI services
4+
description: Install and run content safety analyze image containers with Docker to detect harmful content in image.
5+
author:
6+
manager:
7+
ms.service: azure-ai-content-safety
8+
ms.topic:
9+
ms.date: 9/11/2024
10+
ms.author:
11+
keywords: on-premises, Docker, container
12+
---
13+
14+
# Analyze image content with docker containers
15+
16+
The analyze image container scans image for sexual content, violence, hate, and self harm with multi-severity levels. In this article, you learn how to download, install, and run a content safety to image container.
17+
18+
For more information about prerequisites, validating that a container is running, running multiple containers on the same host, and running disconnected containers, see [Install and run content safety containers with Docker](container-install-run.md).
19+
20+
## Container images
21+
22+
The content safety analyze image container image for all supported versions can be found on the [Microsoft Container Registry (MCR)]( https://mcr.microsoft.com/en-us/product/azure-cognitive-services/contentsafety/image-analyze/tags) syndicate. It resides within the `azure-cognitive-services/contentsafety` repository and is named `image-analyze`.
23+
24+
25+
26+
**to do: update MCR screenshot** **[to-do]** update MCR screenshot for AACS image analyze image. the MCR release is in progress, expect to finish by EOD 9/20 PST. the MCR link is https://mcr.microsoft.com/en-us/product/azure-cognitive-services/contentsafety/image-analyze/tags
27+
28+
29+
The fully qualified container image name is, `mcr.microsoft.com/en-us/product/azure-cognitive-services/contentsafety/image-analyze`. Either append a specific version or append `:latest` to get the most recent version.
30+
31+
| Version | Path |
32+
|-----------|------------|
33+
| Latest | `mcr.microsoft.com/azure-cognitive-services/contentsafety/image-analyze:latest`<br/><br/>The `latest` tag pulls the latest image. |
34+
|1.0.0-amd64-preview|`mcr.microsoft.com/azure-cognitive-services/contentsafety/image-analyze:1.0.0-amd64-preview`|
35+
36+
## Get the container image with docker pull
37+
38+
You need the [prerequisites](container-install-run.md#prerequisites) including required hardware. Also see the [recommended allocation of resources](container-install-run.md#host-computer-requirements-and-recommendations)
39+
for each content safety container.
40+
41+
Use the [docker pull](https://docs.docker.com/engine/reference/commandline/pull/) command to download a container image from Microsoft Container Registry:
42+
43+
```bash
44+
docker mcr.microsoft.com/azure-cognitive-services/contentsafety/image-analyze:latest
45+
```
46+
47+
48+
## Run the container with docker run
49+
50+
Use the [docker run](https://docs.docker.com/engine/reference/commandline/run/) command to run the container.
51+
52+
# [Standard container](#tab/standard)
53+
54+
The following table represents the various `docker run` parameters and their corresponding descriptions:
55+
56+
| Parameter | Description |
57+
|---------|---------|
58+
| `{ENDPOINT_URI}` | The endpoint is required for metering and billing. For more information, see [billing arguments](content safety-container-howto.md#billing-arguments). |
59+
| `{API_KEY}` | The API key is required. For more information, see [billing arguments](content safety-container-howto.md#billing-arguments). |
60+
61+
When you run the content safety to image container, configure the port, memory, and CPU according to the content safety to image container [requirements and recommendations](content safety-container-howto.md#container-requirements-and-recommendations).
62+
63+
Here's an example `docker run` command with placeholder values. You must specify the `ENDPOINT_URI` and `API_KEY` values:
64+
65+
```bash
66+
docker run --rm -it -p 5000:5000 --gpus all \
67+
mcr.microsoft.com/azure-cognitive-services/contentsafety/image-analyze:latest \
68+
Eula=accept \
69+
Billing={ENDPOINT_URI} \
70+
ApiKey={API_KEY}
71+
```
72+
73+
This command:
74+
* Runs a `image-analyze` container from the container image.
75+
* `--gpus all` Use all available GPU resources. Content safety container requires CUDA for optimal performance. See more in [host requirements and recommendations](./container-install-run.md#host-computer-requirements-and-recommendations). Also make sure your host install [NVIDIA container toolkit](./container-install-run.md#installing-the-nvidia-container-toolkit)
76+
* Exposes TCP port 5000 and allocates a pseudo-TTY for the container.
77+
* Automatically removes the container after it exits. The container image is still available on the host computer.
78+
79+
# [Disconnected container](#tab/disconnected)
80+
81+
To run disconnected containers (not connected to the internet), you must submit [this request form](https://aka.ms/csdisconnectedcontainers) and wait for approval. For more information about applying and purchasing a commitment plan to use containers in disconnected environments, see [Use containers in disconnected environments](../containers/disconnected-containers.md) in the Azure AI services documentation.
82+
83+
If you're approved to run the container disconnected from the internet, the following example shows the formatting of the `docker run` command to use, with placeholder values. Replace these placeholder values with your own values.
84+
85+
The `DownloadLicense=True` parameter in your `docker run` command downloads a license file to enable your Docker container to run when it isn't connected to the internet. It also contains an expiration date, after which the license file is invalid to run the container. You can only use a license file with the appropriate container that you're approved for. For example, you can't use a license file for a `content safety-to-image` container with a `neural-image-to-content safety` container.
86+
87+
| Placeholder | Description |
88+
|-------------|-------|
89+
| `{IMAGE}` | The container image you want to use.<br/><br/>For example: `mcr.microsoft.com/azure-cognitive-services/content safety-to-image:latest` |
90+
| `{LICENSE_MOUNT}` | The path where the license is downloaded, and mounted.<br/><br/>For example: `/host/license:/path/to/license/directory` |
91+
| `{ENDPOINT_URI}` | The endpoint for authenticating your service request. You can find it on your resource's **Key and endpoint** page, on the Azure portal.<br/><br/>For example: `https://<your-resource-name>.cognitiveservices.azure.com` |
92+
| `{API_KEY}` | The key for your content safety resource. You can find it on your resource's **Key and endpoint** page, on the Azure portal. |
93+
| `{CONTAINER_LICENSE_DIRECTORY}` | Location of the license folder on the container's local filesystem.<br/><br/>For example: `/path/to/license/directory` |
94+
95+
```bash
96+
docker run --rm -it -p 5000:5000 \
97+
-v {LICENSE_MOUNT} \
98+
{IMAGE} \
99+
eula=accept \
100+
billing={ENDPOINT_URI} \
101+
apikey={API_KEY} \
102+
DownloadLicense=True \
103+
Mounts:License={CONTAINER_LICENSE_DIRECTORY}
104+
```
105+
106+
Once the license file is downloaded, you can run the container in a disconnected environment. The following example shows the formatting of the `docker run` command you use, with placeholder values. Replace these placeholder values with your own values.
107+
108+
Wherever the container is run, the license file must be mounted to the container and the location of the license folder on the container's local filesystem must be specified with `Mounts:License=`. An output mount must also be specified so that billing usage records can be written.
109+
110+
Placeholder | Value | Format or example |
111+
|-------------|-------|---|
112+
| `{IMAGE}` | The container image you want to use.<br/><br/>For example: `mcr.microsoft.com/azure-cognitive-services/content safety-to-image:latest` |
113+
`{MEMORY_SIZE}` | The appropriate size of memory to allocate for your container.<br/><br/>For example: `4g` |
114+
| `{NUMBER_CPUS}` | The appropriate number of CPUs to allocate for your container.<br/><br/>For example: `4` |
115+
| `{LICENSE_MOUNT}` | The path where the license is located and mounted.<br/><br/>For example: `/host/license:/path/to/license/directory` |
116+
| `{OUTPUT_PATH}` | The output path for logging.<br/><br/>For example: `/host/output:/path/to/output/directory`<br/><br/>For more information, see [usage records](../containers/disconnected-containers.md#usage-records) in the Azure AI services documentation. |
117+
| `{CONTAINER_LICENSE_DIRECTORY}` | Location of the license folder on the container's local filesystem.<br/><br/>For example: `/path/to/license/directory` |
118+
| `{CONTAINER_OUTPUT_DIRECTORY}` | Location of the output folder on the container's local filesystem.<br/><br/>For example: `/path/to/output/directory` |
119+
120+
```bash
121+
docker run --rm -it -p 5000:5000 --memory {MEMORY_SIZE} --cpus {NUMBER_CPUS} \
122+
-v {LICENSE_MOUNT} \
123+
-v {OUTPUT_PATH} \
124+
{IMAGE} \
125+
eula=accept \
126+
Mounts:License={CONTAINER_LICENSE_DIRECTORY}
127+
Mounts:Output={CONTAINER_OUTPUT_DIRECTORY}
128+
```
129+
130+
Content safety containers provide a default directory for writing the license file and billing log at runtime. The default directories are /license and /output respectively.
131+
132+
When you're mounting these directories to the container with the `docker run -v` command, make sure the local machine directory is set ownership to `user:group nonroot:nonroot` before running the container.
133+
134+
Here's a sample command to set file/directory ownership.
135+
136+
```bash
137+
sudo chown -R nonroot:nonroot <YOUR_LOCAL_MACHINE_PATH_1> <YOUR_LOCAL_MACHINE_PATH_2> ...
138+
```
139+
140+
---
141+
142+
## Test the container
143+
144+
Once the container is up and running, you can validate its operation by sending a request to the REST endpoint deployed within the container. To do this, follow below article. Note, you need to replace the endpoint URL with the Docker URL specific to your container deployment. Also, ensure that you're using host authentication, rather than key-based authentication.
145+
146+
147+
- [analyze image quick start](./quickstart-text.md#analyze-image-content)
148+
149+
150+
151+
152+
153+
## Next steps
154+
155+
* See the [content safety containers overview](content safety-container-overview.md)
156+
* Review [configure containers](content safety-container-configuration.md) for configuration settings
157+
* Use more [Azure AI containers](../cognitive-services-container-support.md)

0 commit comments

Comments
 (0)