binoua commited on
Commit
46dab14
1 Parent(s): e06e968

chore: using a database for keys

Browse files
Files changed (1) hide show
  1. handler.py +13 -9
handler.py CHANGED
@@ -49,17 +49,21 @@ class EndpointHandler:
49
 
50
  return uid
51
 
52
- assert method == "inference":
53
 
54
- uid = data.pop("uid", data)
55
 
56
- # Get inputs
57
- encrypted_inputs = from_json(data.pop("encrypted_inputs", data))
58
 
59
- # Find key in the database
60
- evaluation_keys = self.key_database[uid]
61
 
62
- # Run CML prediction
63
- encrypted_prediction = self.fhemodel_server.run(encrypted_inputs, evaluation_keys)
64
 
65
- return to_json(encrypted_prediction)
 
 
 
 
 
49
 
50
  return uid
51
 
52
+ elif method == "inference":
53
 
54
+ uid = data.pop("uid", data)
55
 
56
+ # Get inputs
57
+ encrypted_inputs = from_json(data.pop("encrypted_inputs", data))
58
 
59
+ # Find key in the database
60
+ evaluation_keys = self.key_database[uid]
61
 
62
+ # Run CML prediction
63
+ encrypted_prediction = self.fhemodel_server.run(encrypted_inputs, evaluation_keys)
64
 
65
+ return to_json(encrypted_prediction)
66
+
67
+ else:
68
+
69
+ return