Guide for Integrating Private AI DEID container with Azure OCR
This guide provides step-by-step instructions on setting up the Private AI container with the Azure OCR for processing images and documents. Both the cloud and containerized versions of Azure OCR are supported.
Prerequisites
- Docker Compose installed on your system.
- Access to Private AI's DEID container. See Grabbing the Image for more info on this.
- An Azure account and a subscription to Azure Computer Vision service.
Step 1: Create Azure Computer Vision Service
- Navigate to the Azure Portal.
-
Create a new Azure Computer Vision service by following the link:
https://portal.azure.com/#create/Microsoft.CognitiveServicesComputerVision
. (You can also use your existing Azure Computer Vision service) - Note down your Computer Vision service endpoint and the key.
Step 2: Configure Docker Compose File
-
Create a
docker-compose.yml
file in your preferred text editor. - Configure the DEID service and Azure OCR either using either cloud (2A) or containerized (2B) Azure Computer Vision service.
Step 2A: Docker Compose for Cloud Azure Computer Vision Service
version: '3.8'
services:
deid_service:
image: crprivateaiprod.azurecr.io/deid:gpu
shm_size: "4g"
container_name: deid_container
tty: true
environment:
- PAI_OCR_SYSTEM=azure
- PAI_AZ_COMPUTER_VISION_URL=<Azure Computer Vision Service URL>
- PAI_AZ_COMPUTER_VISION_KEY=<Azure Computer Vision Key>
- PAI_OUTPUT_FILE_DIR=<your output directory>
ports:
- "8080:8080"
# Input and output directories are only required when using URI file processing
volumes:
- <path to license.json>:/app/license/license.json
- <input file directory>:<input file directory>
- <output file directory>:<output file directory>
# comment out this section if you're using a CPU version of deid container.
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
Replace placeholders (e.g., <Azure Computer Vision Service URL>
) with your actual service details.
Step 2B: Docker Compose for Containerized Azure Computer Vision Service
version: '3.8'
services:
deid_service:
image: crprivateaiprod.azurecr.io/deid:gpu
shm_size: "4g"
container_name: deid_container
tty: true
environment:
- PAI_OCR_SYSTEM=azure
- PAI_AZ_COMPUTER_VISION_URL=http://azure_vision_service:5000
- PAI_AZ_COMPUTER_VISION_KEY=<Azure Computer Vision Key>
- PAI_OUTPUT_FILE_DIR=<your output directory>
ports:
- "8080:8080"
# Input and output directories are only required when using URI file processing
volumes:
- <path to license.json>:/app/license/license.json
- <input file directory>:<input file directory>
- <output file directory>:<output file directory>
# comment out this section if you're using a CPU version of deid container.
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
azure_vision_service:
image: mcr.microsoft.com/azure-cognitive-services/vision/read:latest
container_name: azure_vision_container
tty: true
environment:
- Eula=accept
- Billing=<Azure Computer Vision Resource Endpoint>
- ApiKey=<Azure Computer Vision Resource Key>
deploy:
resources:
limits:
memory: 16G
cpus: '8'
For further details on the Azure Computer Vision container please refer to the Azure Documentation.
Step 3: Start the Containers
Open a terminal and navigate to the directory containing your docker-compose.yml
file. Run the following command to start the containers:
docker compose -f docker-compose.yml up
Step 4: Verify Operation
Once the containers are running, you can verify their operation by accessing the DEID service's exposed port (e.g., http://localhost:8080
) and performing a test OCR operation on your documents or images.