romanbredehoft-zama commited on
Commit
999f0b2
1 Parent(s): 9a997e4

Fix comments and imlearn version

Browse files
app.py CHANGED
@@ -19,8 +19,6 @@ from settings import (
19
  FAMILY_STATUS,
20
  )
21
  from backend import (
22
- shorten_bytes_object,
23
- clean_temporary_files,
24
  pre_process_keygen_encrypt_send_user,
25
  pre_process_keygen_encrypt_send_bank,
26
  pre_process_keygen_encrypt_send_third_party,
 
19
  FAMILY_STATUS,
20
  )
21
  from backend import (
 
 
22
  pre_process_keygen_encrypt_send_user,
23
  pre_process_keygen_encrypt_send_bank,
24
  pre_process_keygen_encrypt_send_third_party,
backend.py CHANGED
@@ -53,7 +53,7 @@ def shorten_bytes_object(bytes_object, limit=500):
53
 
54
 
55
  def clean_temporary_files(n_keys=20):
56
- """Clean keys and encrypted images.
57
 
58
  A maximum of n_keys keys and associated temporary files are allowed to be stored. Once this
59
  limit is reached, the oldest files are deleted.
@@ -100,7 +100,7 @@ def _get_client(client_id, client_type):
100
 
101
 
102
  def _keygen(client_id, client_type):
103
- """Generate the private key associated to a filter.
104
 
105
  Args:
106
  client_id (int): The client ID to consider.
@@ -129,7 +129,7 @@ def _keygen(client_id, client_type):
129
 
130
 
131
  def _send_input(client_id, client_type):
132
- """Send the encrypted input image as well as the evaluation key to the server.
133
 
134
  Args:
135
  client_id (int): The client ID to consider.
@@ -150,7 +150,7 @@ def _send_input(client_id, client_type):
150
  ("files", open(evaluation_key_path, "rb")),
151
  ]
152
 
153
- # Send the encrypted input image and evaluation key to the server
154
  url = SERVER_URL + "send_input"
155
  with requests.post(
156
  url=url,
@@ -210,7 +210,7 @@ def _keygen_encrypt_send(inputs, client_type):
210
  with encrypted_inputs_path.open("wb") as encrypted_inputs_file:
211
  encrypted_inputs_file.write(encrypted_inputs)
212
 
213
- # Create a truncated version of the encrypted image for display
214
  encrypted_inputs_short = shorten_bytes_object(encrypted_inputs)
215
 
216
  _send_input(client_id, client_type)
@@ -349,7 +349,7 @@ def get_output(user_id, bank_id, third_party_id):
349
  "third_party_id": third_party_id,
350
  }
351
 
352
- # Retrieve the encrypted output image
353
  url = SERVER_URL + "get_output"
354
  with requests.post(
355
  url=url,
 
53
 
54
 
55
  def clean_temporary_files(n_keys=20):
56
+ """Clean keys and encrypted inputs.
57
 
58
  A maximum of n_keys keys and associated temporary files are allowed to be stored. Once this
59
  limit is reached, the oldest files are deleted.
 
100
 
101
 
102
  def _keygen(client_id, client_type):
103
+ """Generate the private key associated to a client.
104
 
105
  Args:
106
  client_id (int): The client ID to consider.
 
129
 
130
 
131
  def _send_input(client_id, client_type):
132
+ """Send the encrypted inputs as well as the evaluation key to the server.
133
 
134
  Args:
135
  client_id (int): The client ID to consider.
 
150
  ("files", open(evaluation_key_path, "rb")),
151
  ]
152
 
153
+ # Send the encrypted inputs and evaluation key to the server
154
  url = SERVER_URL + "send_input"
155
  with requests.post(
156
  url=url,
 
210
  with encrypted_inputs_path.open("wb") as encrypted_inputs_file:
211
  encrypted_inputs_file.write(encrypted_inputs)
212
 
213
+ # Create a truncated version of the encrypted inputs for display
214
  encrypted_inputs_short = shorten_bytes_object(encrypted_inputs)
215
 
216
  _send_input(client_id, client_type)
 
349
  "third_party_id": third_party_id,
350
  }
351
 
352
+ # Retrieve the encrypted output
353
  url = SERVER_URL + "get_output"
354
  with requests.post(
355
  url=url,
deployment_files/client.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:06c7bd8264089eb169342aa5c3f638b11d894c54d054511a91523bfdfab69487
3
- size 76130
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1661827a0038bff99f6c880f3528409d0468e4a0466fb63d2967736599157a74
3
+ size 76152
deployment_files/server.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:04c3f1de7261abe6ad075f6cc13885677ddf4ca0b03d6a31f26a60f94d5aa2ae
3
- size 10975
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c2167b544eeea289a485070216ee01694f3f15df856067f7458878b78452836
3
+ size 11049
requirements.txt CHANGED
@@ -1,4 +1,3 @@
1
- # concrete-ml==1.3.0
2
  gradio==3.40.1
3
  concrete-ml==1.3.0
4
- imblearn==0.0
 
 
1
  gradio==3.40.1
2
  concrete-ml==1.3.0
3
+ imbalanced-learn==0.11.0
server.py CHANGED
@@ -5,10 +5,10 @@ from typing import List
5
  from fastapi import FastAPI, File, Form, UploadFile
6
  from fastapi.responses import JSONResponse, Response
7
 
8
- from settings import DEPLOYMENT_PATH, SERVER_FILES, CLIENT_TYPES
9
  from utils.client_server_interface import MultiInputsFHEModelServer
10
 
11
- # Load the server objects related to all currently available filters once and for all
12
  FHE_SERVER = MultiInputsFHEModelServer(DEPLOYMENT_PATH)
13
 
14
 
 
5
  from fastapi import FastAPI, File, Form, UploadFile
6
  from fastapi.responses import JSONResponse, Response
7
 
8
+ from settings import DEPLOYMENT_PATH, SERVER_FILES
9
  from utils.client_server_interface import MultiInputsFHEModelServer
10
 
11
+ # Load the server
12
  FHE_SERVER = MultiInputsFHEModelServer(DEPLOYMENT_PATH)
13
 
14