Quickstart Guide
This guide will help you to get started with setting up the Private AI container on your local machine. Please follow the instructions specific to your operating system.
Prerequisites
The only prerequisite is Docker (Docker Desktop on Windows and macOS).
Linux
Check out the installation instructions for Docker on Linux here
macOS
Check out the installation instructions for Docker Desktop on macOS here
Windows
Check out the installation instructions for Docker Desktop on Windows here
Check CPU and RAM allocated to Docker
Make sure you have sufficient CPU cores and RAM allocated to Docker. At the moment the minimum requirements are 6GB RAM and 1 logical CPU core (check System Requirements).
To check/update RAM and CPU cores allocated to Docker Desktop, check out this Docker user manual.
Note: Make sure that you restart Docker Desktop after updating the RAM and CPU settings.
Starting up DEID container
Once you have all the prerequisites, it's time to grab the deid
image from Docker Hub. Everything including the ML models is included - no further downloads or configuration is required.
Login to Docker registry
Login to Private AI's Docker registry so that you can pull private images from there.
docker login -u paiuser -p <Access Token>
Contact us to get your Access Token.
Pull the Docker image
Once you are logged in, pull the appropriate version of the Docker image.
docker pull privateai/deid:<version>
Once loaded, the deid image should be listed under your Docker images. To check, you can run the following command:
docker images | grep deid
# Example output
privateai/deid <version> 15c6457d8c19 1 min ago 2.15GB
Start the container
Now that we have the Docker image, we can start the container:
docker run --rm -p 8080:8080 -it privateai/deid:<version>
A successful container startup will output the following logs:
Log level is: info
Image Version: <version>
Using OX-E
Using 4 threads
.
.
.
INFO: Started server process [9]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
Sample commands
Try these sample commands to deidentify your text. You will need to use your API key in the payload, you can get one by contacting us.
Curl
A sample curl command to deidentify text.
curl \
--request POST \
--url 'http://localhost:8080/deidentify_text' \
--header 'Content-Type: application/json' \
--data '{"text": "Hi John, Grace this side. It'\''s been a while since we last met in Berlin.", "key": "<YOUR_API_KEY>"}'
Python
A sample command for Python using the requests library.
import requests
import json
url = "http://localhost:8080/deidentify_text"
payload = json.dumps({
"text": "Hi John, Grace this side. It's been a while since we last met in Berlin.",
"key": "<YOUR_API_KEY>"
})
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, data=payload)
response.raise_for_status()
print(response.json())
NodeJS
A sample command for NodeJS using the axios library.
const axios = require("axios");
const data = JSON.stringify({
"text": "Hi John, Grace this side. It's been a while since we last met in Berlin.",
"key": "<YOUR_API_KEY>"
});
var config = {
method: "post",
url: "http://localhost:8080/deidentify_text",
headers: {
"Content-Type": "application/json"
},
data: data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Sample Output
Here is a typical output for the commands above.
{
"result": "Hi [NAME_1], [NAME_2] this side. It's been a while since we last met in [LOCATION_CITY_1].",
"result_fake": null,
"pii": [
{
"marker": "NAME_1",
"text": "John",
"best_label": "NAME",
"stt_idx": 3,
"end_idx": 7,
"labels": {
"NAME": 0.8446
}
},
{
"marker": "NAME_2",
"text": "Grace",
"best_label": "NAME",
"stt_idx": 9,
"end_idx": 14,
"labels": {
"NAME": 0.8399
}
},
{
"marker": "LOCATION_CITY_1",
"text": "Berlin",
"best_label": "LOCATION_CITY",
"stt_idx": 63,
"end_idx": 69,
"labels": {
"LOCATION_CITY": 0.8778,
"LOCATION": 0.8512
}
}
],
"api_calls_used": 1,
"output_checks_passed": true
}
Please check out our API Reference documentation to get more information about our APIs.