Skip to main content

A client library for FHE-enabled machine learning via BlindMLServer

Project description

BlindMLClient

BlindMLClient is a Python client library designed to interact with the BlindMLServer, which hosts models powered by Fully Homomorphic Encryption (FHE).
It enables users to perform secure, encrypted predictions without ever exposing raw input data — ensuring full privacy throughout the inference pipeline.

✨ Features

  • Initialize a secure connection with an FHE-enabled inference server
  • Encrypt input data using Fully Homomorphic Encryption (FHE)
  • Send encrypted data and perform remote inference
  • Decrypt the server's encrypted prediction result into readable output
  • Supports integration with Concrete-ML

📦Installation

pip install blindml

🚀 Example Usage

import blindml

# Define server URL and your API key
SERVER_URL = "http://127.0.0.1:3000/proxy/cm/43f75fc1-488e-4ebb-82dd-2f59ee80f3ce"
API_KEY = "YOUR_API_KEY"

# Initialize the client
bm = blindml()
bm.init(server_url=SERVER_URL, api_key=API_KEY)

# Example input (e.g., model features)
input_data = [1.5, 2.3, 3.7]

# Step 1: Encrypt the input
encrypted_input = bm.encrypt(input_data)

# Step 2: Send encrypted input and receive encrypted prediction
encrypted_prediction = bm.predict(encrypted_input)

# Step 3: Decrypt the result
prediction = bm.decrypt(encrypted_prediction)

print("Prediction result:", prediction)

📚 API Methods

init(server_url: str, api_key: str) -> None

Initializes the BlindMLClient with the server’s endpoint and your authentication key.

  • Parameters:
    • server_url: URL of the deployed BlindMLServer
    • api_key: API key used for authenticating the client

encrypt(input_data: Any) -> EncryptedData

Encrypts the input data using Fully Homomorphic Encryption (FHE).
This prepares the input for secure inference.

  • Parameters:

    • input_data: Input data formatted according to the model's expected input schema
      (e.g., a list of floats, dictionary, or other structure depending on the model)
  • Returns:

    • Encrypted version of the input data

predict(encrypted_input: EncryptedData) -> EncryptedResult

Sends the encrypted input to the server and receives an encrypted prediction result.

  • Parameters:

    • encrypted_input: The output from the encrypt() method
  • Returns:

    • An encrypted prediction result returned by the server

decrypt(encrypted_result: EncryptedResult) -> Any

Decrypts the server’s encrypted prediction and returns it in a human-readable format.

  • Parameters:

    • encrypted_result: The encrypted result from the predict() method
  • Returns:

    • The final decrypted prediction (e.g., a float or label)

📌 Notes

This client library must be used with a running instance of BlindMLServer

All communication and computation are based on Fully Homomorphic Encryption (FHE), providing end-to-end data privacy

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

blindml-0.1.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blindml-0.1.2-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file blindml-0.1.2.tar.gz.

File metadata

  • Download URL: blindml-0.1.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for blindml-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7aaf4c362c8485d7c936bc752802f5f5efefc017b7fae7252ec5116ac91aeafb
MD5 348ed6905cf21b24e3be17d0aa4332d8
BLAKE2b-256 f64843ba3d072efe129ece1d232e6bdb70417ac7688672c4005b17f75bf1d0bd

See more details on using hashes here.

File details

Details for the file blindml-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: blindml-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for blindml-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7dc2812c3408e608add5c532f56b0e0134898dfc89ab5d5c879c381895743ff0
MD5 673dcc59af1f21ab88297efdd024fdb4
BLAKE2b-256 f73c52d5be4b610d333ca853791623db0aa24c474acad6575a721ff05e0ac746

See more details on using hashes here.

Supported by

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