Shortcuts

Quickstart Guide

This guide will help you to get started with setting up the Private AI container (deid) 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 install instructions for Docker on Linux here.

macOS

Check out the installation instructiosn 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 4 CPU cores. (Check System Requirements for more information).

To check/update RAM & CPU cores allocated to Docker Desktop, check out out this Docker user manual.

Note: Make sure that you restart Docker Desktop after updating the RAM and CPUs.

Starting up DEID container

Once you have all the prerequisites, you’ll need to get the deid Docker image from Docker Hub.

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 reflect in your list of Docker images. To check, run:

>> docker images | grep deid
privateai/deid   latest    15c6457d8c19   1 min ago   2.15GB

Note: The tag of the Docker image might be different for you.

Start the container

Now that we have Docker image, let’s start the container:

docker run --rm -p 8080:8080 -it deid:<version number>

Note: Choose the appropriate version number.

A successful start of the container will give logs like this:

Log level is: info
Image Version: 2.10full
Using OX-E
Using 4 threads
Using OX-E
Using 4 threads
Using OX-E
Using 4 threads
Using OX-E
Using 4 threads
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)
INFO:     127.0.0.1:33752 - "GET /healthz HTTP/1.1" 200 OK
INFO:     127.0.0.1:33754 - "GET /healthz HTTP/1.1" 200 OK

Sample commands

Try these sample commands to deidentify your text. You’ll need to put a key in the payload, contact us to get yours.

Curl

A sample curl command to deidentify text.

curl --location --request POST 'http://localhost:8080/deidentify_text' \
--header 'Content-Type: application/json' \
--data-raw '{"text": "Hi John, Grace this side. It'\''s been a while since we last met in Berlin.", "key": "<PUT-YOUR-KEY-HERE>"}'

Python - Requests

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": "<PUT-YOUR-KEY-HERE>"
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

NodeJS - Request

A sample command for NodeJS using request.

var axios = require('axios');
var data = JSON.stringify({
  "text": "Hi John, Grace this side. It's been a while since we last met in Berlin.",
  "key": "<PUT-YOUR-KEY-HERE>"
});

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’s 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.