Quickstart Guide

This quickstart guide covers how to set up and run the Private AI container.

info

If you'd like to use the Private AI-hosted API, which includes the free demo, please create a portal account and use the code examples provided in the portal.

Setting up the Container

The Private AI container can be obtained either on the AWS and Azure marketplaces, or directly from Private AI. Instructions for each are described below.

AWS Marketplace

You can rapidly get up and running by subscribing to the AWS Marketplace and automatically deploying to either AWS EKS or AWS ECS. Check out AWS Marketplace Container Deployment Guide for more information.

Azure Marketplace

Similar to the AWS Marketplace, you can grab the container on the Azure Marketplace here.

Private AI Direct

Follow the steps below if you have a full customer license to get started quickly.

Logging into the Customer Portal

When you are onboarded, a customer portal account will be created for you. In the portal you can find helpful links, download your license file and instructions on how to login to our container registry and pull the latest container image.

If you haven't received this information yet during your onboarding, please contact our customer support team via your dedicated Slack channel, or at support@private-ai.com

Getting the Container

Once you've logged into the customer portal, you will find some commands to get the latest container. The container is distributed via a container registry on Azure, which you can login to with the command found in the portal that looks like this:

Copy
Copied
docker login -u INSERT_UNIQUE_CLIENT_ID -p INSERT_UNIQUE_CLIENT_PW crprivateaiprod.azurecr.io

Please reach out to our customer support if you are experiencing issues.

Getting a License

When you are logged into the customer portal, you should find the license file (or files) assigned to your account in the top right of the main page. There will be a download link beside the file along with information about the license tier and expiry date.

Starting up the Container

Starting with 3.0, license files are used for authentication. To start the container, please mount the license file as follows:

Copy
Copied
docker run --rm -v "full path to your license.json file":/app/license/license.json \
-p 8080:8080 -it crprivateaiprod.azurecr.io/deid:<tag>

For example:

Copy
Copied
docker run --rm -v "/home/johnsmith/paisandbox/my-license-file.json":/app/license/license.json \
-p 8080:8080 -it crprivateaiprod.azurecr.io/deid:3.0.0-cpu

Sending Requests

You can then make a request to the container like this:

Copy
Copied
curl --request POST --url http://localhost:8080/v3/process/text --header 'Content-Type: application/json' --data '{"text": ["Hello John"]}'

Processing Files

Processing files can be done by sending base64-encoded files to the /v3/process/files/base64 route:

Copy
Copied
import base64
import requests

filename_in = "<input filename>"
filename_out = "<output filename>"

# Read the file and do base64 encoding
with open(filename_in, "rb") as f:
    b64_file_content = base64.b64encode(f.read())
    b64_file_content = b64_file_content.decode("utf-8")

# Make the request and load the results as JSON
r = requests.post(url="http://localhost:8080/v3/process/files/base64", 
                  json={"file": {"data": b64_file_content, "content_type": "image/jpg"}})
results = r.json()

# Decode and write the file to disk
with open(filename_out, "wb") as f:
    f.write(base64.b64decode(results["processed_file"]))

It is also possible to send URIs instead to the /v3/process/files/uri route, avoiding the overhead of base64 encoding and avoiding sending any sensitive information in the request. Please see Running the Container for details.

© Copyright 2024 Private AI.