Skip to main content

Official HiddenLayer Python SDK

Project description

HiddenLayer SDK Python (Beta)

Hiddenlayer is a Python SDK that provides a simple and efficient way to interact with the Hiddenlayer API, a platform for building and deploying machine learning models. The SDK allows developers to easily protect models using the Hiddenlayer API, without having to write complex code or manage the underlying infrastructure.

Contents

Installation

Install from PyPi using pip, a package manager for Python.

pip install hiddenlayer-sdk

Scanning models on different platforms such as AWS S3 and Huggingface are supported. You can install the dependenices yourself or via optional dependencies:

pip install hiddenlayer-sdk[aws]
pip install hiddenlayer-sdk[azure]
pip install hiddenlayer-sdk[hf]

Getting Started

Once you've installed the hiddenlayer package, you can instantiate the HiddenlayerServiceClient for the SaaS platform as follows:

from hiddenlayer import HiddenlayerServiceClient

hl_client = HiddenlayerServiceClient(
  host="https://api.us.hiddenlayer.ai",
  api_id=..., # Your Hiddenlayer API Client ID
  api_key=... # Your Hiddenalyer API Secret Key
)

If you are using the Enterprise version of the production, you can instantiate the HiddenlayerServiceClient as follows:

from hiddenlayer import HiddenlayerServiceClient

hl_client = HiddenlayerServiceClient(
  host="https://your.hiddenlayer.enterprise.url",
)

Scanning Models

hl_client.model_scanner.scan_file(
  model_name="name_of_the_model",
  model_path="path/to/model/file.pkl"
)

Using AIDR for Predictive Models

Note: This is only supported using the SaaS version of the platform.

model = hl_client.model.create_model(model_name="example_model")

hl_client.aidr_predictive.submit_vectors(
  model_id=model.sensor_id,
  requestor_id="custom-source-id",
  input_vectors=X,
  output=y
)

Code Examples

Code examples can be found in the repo here

Interface Stability

Hiddenlayer is actively working on stabilizing the Hiddenlayer SDK for Python's interfaces. You are highly encouraged to pin the exact dependency version.

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

hiddenlayer_sdk-0.1.0.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

hiddenlayer_sdk-0.1.0-py3-none-any.whl (66.0 kB view details)

Uploaded Python 3

File details

Details for the file hiddenlayer_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: hiddenlayer_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for hiddenlayer_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4c686a7642606b2b46afe9cd4e07e3e70226fe9ec4ee5e990dc9df835eb9d797
MD5 fdc459fa084084dfe2810ec4f184becb
BLAKE2b-256 b51c796664c42d12f204632afd999dac1f7ef43b0a03bd3e2cee74c878dc1fdc

See more details on using hashes here.

File details

Details for the file hiddenlayer_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hiddenlayer_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1006c557c846d56cc8072de323411e03fb07599ad7079c8f74253165c0718a49
MD5 22ce9a929eabf5a442a3c07f5eab6b30
BLAKE2b-256 f4f5d5e48c20be1f1154b105414ff2f901c6ff97598cd92a36ee9cb6fe08ed11

See more details on using hashes here.

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