This example demonstrates how you can deploy a function that performs secure image recognition using a TensorFlow Lite model. By using Cape, the model is protected because it can only be accessed within a secure enclave. The input data is also protected because it is encrypted prior to being uploaded, and is sent over TLS into the Cape enclave.
Clone the capeprivacy/functions public repository:
git clone email@example.com:capeprivacy/functions.git
Navigate into the folder containing the code for the image recognition function:
Install the required dependencies into a target folder (named
deploy in our example):
docker run -v `pwd`:/build -w /build --rm -it python:3.9-slim-bullseye pip install -r requirements.txt --target ./deploy/
sudo may be required when running this command.
Log in to Cape using:
Your CLI confirmation code is: <SOME_CODE>
Visit this URL to complete the login process: https://login.capeprivacy.com/activate?user_code=<SOME_CODE>
Congratulations, you're all set!
Deploy your function to Cape using:
cape deploy ./deploy
Deploying function to Cape ...
Success! Deployed function to Cape
Function ID ➜ jjAxk3CFnRx7whdi5oPffQ
Checksum ➜ 00f617b57eebfaa29b7f091b3dab104fc690b2173d0de8fa46dc5d426bf6a2e1
Invoke your function using:
cape run jjAxk3CFnRx7whdi5oPffQ -f cat.jpg
Image Label is : 'Egyptian cat' with Accuracy : 72.27 %.
Feel free to try with other images:
cape run jjAxk3CFnRx7whdi5oPffQ -f coffee.jpg
cape run jjAxk3CFnRx7whdi5oPffQ -f lizzard.jpg