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 BlindMLServerapi_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 theencrypt()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 thepredict()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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blindml-0.1.1.tar.gz.
File metadata
- Download URL: blindml-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62a3c5906e513554eb5b51ded17ea23267ec692d550007c71abbc7d1f0bbb669
|
|
| MD5 |
ad03da02af4a9c5a95de1ab0430ddc74
|
|
| BLAKE2b-256 |
c6151d81101dd55f77b4a2ddc72143622df3777eb66deb92d28f8dbec5eae21c
|
File details
Details for the file blindml-0.1.1-py3-none-any.whl.
File metadata
- Download URL: blindml-0.1.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
481239c80113fb3472a9c347eb680c7a246392ff7890bf66c6813ab8a1aeca21
|
|
| MD5 |
51eca5a246ad7569990dcf171fba18bc
|
|
| BLAKE2b-256 |
008faeecbe563c5f02371c2a036512bc8aaaeb5aa37ca7cdc5b7ffc79f113763
|