You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Upload homomorphic encryption generated public keys to the workspace default blob store. This will allow you to share the keys with the inference server.
264
246
265
-
datastore = ws.get_default_datastore()
266
-
container_name=datastore.container_name
247
+
```python
248
+
import azureml.core
249
+
from azureml.core import Workspace, Datastore
250
+
import os
267
251
268
-
# Create a local file and write the keys to it
269
-
public_keys = open(public_keys_blob, "wb")
270
-
public_keys.write(public_keys_data)
271
-
public_keys.close()
252
+
ws = Workspace.from_config()
272
253
273
-
# Upload the file to blob store
274
-
datastore.upload_files([public_keys_blob])
254
+
datastore = ws.get_default_datastore()
255
+
container_name=datastore.container_name
275
256
276
-
# Delete the local file
277
-
os.remove(public_keys_blob)
278
-
```
257
+
# Create a local file and write the keys to it
258
+
public_keys = open(public_keys_blob, "wb")
259
+
public_keys.write(public_keys_data)
260
+
public_keys.close()
279
261
280
-
### Encrypt the test data
262
+
# Upload the file to blob store
263
+
datastore.upload_files([public_keys_blob])
281
264
282
-
```python
283
-
#choose any one sample from the test data
284
-
sample_index = 1
265
+
# Delete the local file
266
+
os.remove(public_keys_blob)
267
+
```
285
268
286
-
#encrypt the data
287
-
raw_data = edp.encrypt(X_test[sample_index])
269
+
1. Encrypt the test data
288
270
289
-
```
271
+
```python
272
+
#choose any one sample from the test data
273
+
sample_index = 1
290
274
291
-
### Send the test data to the encrypted ACI web service
275
+
#encrypt the data
276
+
raw_data = edp.encrypt(X_test[sample_index])
292
277
293
-
Provide the test dataset to the model to get predictions. We will need to send the connection string to the blob storage where the public keys were uploaded.
278
+
```
294
279
295
-
```python
296
-
import json
297
-
from azureml.core import Webservice
280
+
1. Use the SDK's `run` API to invoke the service and provide the test dataset to the model to get predictions. We will need to send the connection string to the blob storage where the public keys were uploaded.
298
281
299
-
service = Webservice(ws, 'sklearn-encrypted-mnist-svc')
282
+
```python
283
+
import json
284
+
from azureml.core import Webservice
300
285
301
-
#pass the connection string for blob storage to give the server access to the uploaded public keys
0 commit comments