Skip to main content

Azure Percept Model Management Python SDK

Project description

Azure Percept Secured AI Model Management Python SDK

The Python SDK is designed to be used in Jupyter Notebooks, AI module containers as well as stand-alone Python programs. When working on a compatible device, it verifies hardware root of rust through Trusted Platform Module (TPM) attached to the device and uses Azure Attestation service to ensure the hardware and software on the device is not tempered. Then, it authenticates with the Azure Percept backend server with verified device identity and retrieves encrypted AI models or version-specific encryption keys from the server.

Installation

Before the sczpy Python package is official published, you can run the following commaned to install from a local .whl file (see building instructions below):

pip install <path to sczpy .whl file>

Once the package is published, you should be able to install the package by:

pip install sczpy

Usage

When used outside a device context (such as in Jupyter Notebook or a regular Python program), the SDK uses Azure Service Principal to authenticate with the Azure Percept server.

To setup authentication with Azure Service Principal, define the following environment variables:

AZURE_CLIENT_ID
AZURE_CLIENT_SECRET
AZURE_TENANT_ID

Then, use the SDK as the following:

import sczpy

model_name = 'my-sklearn-model'
model_version = 'v1'
server_address = "https://scz-mm.westus2.cloudapp.azure.com:443" # Replace with your own server address

# Create a new client
c = sczpy.SCZClient(server_address)
# Register a model
c.register_model(model_name, model_version)
# Encrypt a model
c.encrypt(model_name, model_version, "your-model.pkl", "your-model.pkl.enc")
# Decrypt a model
c.decrypt(model_name, model_version, "your-model.pkl.enc", "your-model.pkl")

Building sczpy

To build sczpy package, use the following command from the scz-python folder:

python setup.py bdist_wheel #build wheel package
python setup.py sdist #or, build final package (tar)

Developing sczpy

To install sczpy, along with the tools you need to develop and run tests, run the following in your virtualenv:

pip install -e .[dev]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sczpy-0.0.8.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

sczpy-0.0.8-py3-none-any.whl (42.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page