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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sczpy-0.0.8.tar.gz
.
File metadata
- Download URL: sczpy-0.0.8.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c5d7c7bcf49ae78febdb240d1718bcc42df1596a9fd0b9ed092e660d0be0ff3 |
|
MD5 | 253fd7beda13dfc4a1d801bdf66b2d06 |
|
BLAKE2b-256 | 90806203f4a6b38bbfb041ca6a0439b53f33e6d29d04cfb0ea84714d23513cde |
File details
Details for the file sczpy-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: sczpy-0.0.8-py3-none-any.whl
- Upload date:
- Size: 42.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30fca23f0b61d2b19965fd6c6749d8823fe9e7283788ba1d90d7bd9ad1df5053 |
|
MD5 | 160210be2cdcc704ec3450e53f1a30e3 |
|
BLAKE2b-256 | 33c9e583284c8bd08f90ecd174915152fdfbfe7d666ddff743120bea865c1ebc |