binoua commited on
Commit
be526a2
·
1 Parent(s): f629747

Upload 4 files

Browse files
benoit.model/client.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad3930f607d8db8eb34b552addced3924fb10130edc40bc23706882221700176
3
+ size 7625
benoit.model/server.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36d2998857e92d970e887bdbbe6860d5d72bc1a43373d1db5b04e51263d70aa0
3
+ size 4370
benoit.model/versions.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fee531e8b9857b9b7a601f6cf472f81da7b54d909f797f265b0975a35db81462
3
+ size 79
handler.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Dict, List, Any
2
+ import numpy as np
3
+ from concrete.ml.deployment import FHEModelServer
4
+
5
+
6
+ class EndpointHandler:
7
+ def __init__(self, path):
8
+
9
+ # For server
10
+ self.fhemodel_server = FHEModelServer(path)
11
+
12
+ def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
13
+ """
14
+ data args:
15
+ inputs (:obj: `str`)
16
+ date (:obj: `str`)
17
+ Return:
18
+ A :obj:`list` | `dict`: will be serialized and returned
19
+ """
20
+
21
+ # Get inputs
22
+ encrypted_inputs = data.pop("encrypted_inputs", data)
23
+
24
+ # Get keys
25
+ evaluation_keys = data.pop("evaluation_keys", data)
26
+
27
+ # Run CML prediction
28
+ encrypted_prediction = self.fhemodel_server.run(encrypted_inputs, evaluation_keys)
29
+
30
+ return encrypted_prediction