kcelia commited on
Commit
58df7f1
1 Parent(s): 5062baf

chore: add fhe_fn

Browse files
.gitattributes CHANGED
@@ -1,34 +1,6 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
  *.pkl filter=lfs diff=lfs merge=lfs -text
22
  *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tflite filter=lfs diff=lfs merge=lfs -text
29
- *.tgz filter=lfs diff=lfs merge=lfs -text
30
- *.wasm filter=lfs diff=lfs merge=lfs -text
31
- *.xz filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
- *.zst filter=lfs diff=lfs merge=lfs -text
34
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  *.pkl filter=lfs diff=lfs merge=lfs -text
2
  *.pt filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
3
  *.zip filter=lfs diff=lfs merge=lfs -text
4
+ *.extension filter=lfs diff=lfs merge=lfs -text
5
+
6
+ *.bin filter=lfs diff=lfs merge=lfs -text
ConcreteXGBoostClassifier.pkl DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:41e02ed86c34b63aae60c2b275d465ef114572d92531a742bb53199bd54294a0
3
- size 599833
 
 
 
 
app.py CHANGED
@@ -1,87 +1,50 @@
1
- import os
2
- import shutil
3
  import subprocess
4
  import time
5
  from pathlib import Path
6
- from typing import List, Tuple, Union
7
 
8
  import gradio as gr
9
  import numpy as np
10
  import pandas as pd
11
  import requests
12
- from preprocessing import pretty_print
13
  from symptoms_categories import SYMPTOMS_LIST
14
-
15
- from concrete.ml.common.serialization.loaders import load
16
- from concrete.ml.deployment import FHEModelClient, FHEModelDev, FHEModelServer
17
- from concrete.ml.sklearn import XGBClassifier as ConcreteXGBoostClassifier
18
-
19
- INPUT_BROWSER_LIMIT = 635
20
- SERVER_URL = "http://localhost:8000/"
21
- # This repository's main necessary folders
22
- REPO_DIR = Path(__file__).parent
23
- MODEL_PATH = REPO_DIR / "client_folder"
24
- KEYS_PATH = REPO_DIR / ".fhe_keys"
25
- CLIENT_TMP_PATH = REPO_DIR / "client_tmp"
26
- SERVER_TMP_PATH = REPO_DIR / "server_tmp"
27
-
28
- # Create the necessary folders
29
- KEYS_PATH.mkdir(exist_ok=True)
30
- CLIENT_TMP_PATH.mkdir(exist_ok=True)
31
- SERVER_TMP_PATH.mkdir(exist_ok=True)
32
-
33
- subprocess.Popen(["uvicorn", "server:app"], cwd=REPO_DIR)
34
  time.sleep(3)
35
 
 
 
 
36
 
37
- def clean_directory():
38
- target_dir = ".fhe_keys"
39
- if os.path.exists(target_dir) and os.path.isdir(target_dir):
40
- shutil.rmtree(target_dir)
41
- print("The .fhe_keys directory and its contents have been successfully removed.")
42
- else:
43
- print("The .keys directory does not exist.")
44
-
45
-
46
- def load_data():
47
- # Load data
48
- df_train = pd.read_csv("./data/Training_preprocessed.csv")
49
- df_test = pd.read_csv("./data/Testing_preprocessed.csv")
50
-
51
- # Separate the traget from the training set
52
- # df['prognosis] contains the name of the disease
53
- # df['y] contains the numeric label of the disease
54
-
55
- y_train = df_train["y"]
56
- X_train = df_train.drop(columns=["y", "prognosis"], axis=1, errors="ignore")
57
-
58
- y_test = df_train["y"]
59
- X_test = df_test.drop(columns=["y", "prognosis"], axis=1, errors="ignore")
60
-
61
- return (df_train, X_train, X_test), (df_test, y_train, y_test)
62
-
63
-
64
- def load_model(X_train, y_train):
65
- concrete_args = {"max_depth": 1, "n_bits": 3, "n_estimators": 3, "n_jobs": -1}
66
- classifier = ConcreteXGBoostClassifier(**concrete_args)
67
- classifier.fit(X_train, y_train)
68
- circuit = classifier.compile(X_train)
69
 
70
- return classifier, circuit
71
 
 
72
 
73
- def get_user_vect_symptoms_from_checkboxgroup(*user_symptoms) -> np.array:
74
- symptoms_vector = {key: 0 for key in VALID_COLUMNS}
75
-
76
- for symptom_box in user_symptoms:
77
- for pretty_symptom in symptom_box:
78
- symptom = "_".join((pretty_symptom.lower().split(" ")))
79
- if symptom not in symptoms_vector.keys():
80
- raise KeyError(
81
- f"The symptom '{symptom}' you provided is not recognized as a valid "
82
- f"symptom.\nHere is the list of valid symptoms: {symptoms_vector}"
83
- )
84
- symptoms_vector[symptom] = 1.0
85
 
86
  user_symptoms_vect = np.fromiter(symptoms_vector.values(), dtype=float)[np.newaxis, :]
87
 
@@ -90,189 +53,155 @@ def get_user_vect_symptoms_from_checkboxgroup(*user_symptoms) -> np.array:
90
  return user_symptoms_vect
91
 
92
 
93
- def get_user_vector_from_default_disease(disease):
94
-
95
- user_symptom_vector = df_test[df_test["prognosis"] == disease].iloc[0].values
96
-
97
- user_symptoms_vect = np.fromiter(user_symptom_vector[:-2], dtype=float)[np.newaxis, :]
98
-
99
- assert all(value == 0 or value == 1 for value in user_symptoms_vect.flatten())
100
-
101
- return user_symptoms_vect
102
 
 
 
 
103
 
104
- def get_user_symptoms_from_default_disease(disease):
105
- df_filtred = df_test[df_test["prognosis"] == disease]
106
- columns_with_1 = df_filtred.columns[df_filtred.eq(1).any()].to_list()
107
- return pretty_print(columns_with_1)
108
 
 
109
 
110
- def get_user_symptoms_vector_fn(selected_default_disease, *selected_symptoms):
111
 
112
- # Display an error box, if:
113
- # 1. The user has already selected a default disease and added more symptoms, or
114
- # 2. The the user has not selected a default disease or symptoms
115
- if (
116
- any(lst for lst in selected_symptoms if lst)
117
- and (selected_default_disease is not None and len(selected_default_disease) > 0)
118
- and set(pretty_print(selected_symptoms))
119
- - set(get_user_symptoms_from_default_disease(selected_default_disease))
120
- ) or (
121
- not any(lst for lst in selected_symptoms if lst)
122
- and (
123
- selected_default_disease is None
124
- or (selected_default_disease is not None and len(selected_default_disease) < 1)
125
- )
126
- ):
127
  return {
128
- error_box_1: gr.update(
129
  visible=True, value="Enter a default disease or select your own symptoms"
130
  ),
131
  }
132
- # Case 1: The user has checked his own symptoms
133
- if any(lst for lst in selected_symptoms if lst):
134
- return {
135
- error_box_1: gr.update(visible=False),
136
- user_vector_textbox: get_user_vect_symptoms_from_checkboxgroup(*selected_symptoms),
137
- }
138
 
139
- # Case 2: The user has selected a default disease
140
- if selected_default_disease is not None and len(selected_default_disease) > 0:
141
- return {
142
- user_vector_textbox: get_user_vector_from_default_disease(selected_default_disease),
143
- error_box_1: gr.update(visible=False),
144
- **{
145
- box: get_user_symptoms_from_default_disease(selected_default_disease)
146
- for box in check_boxes
147
- },
148
- }
149
 
 
 
150
 
151
- def key_gen_fn(user_symptoms):
 
152
 
153
- print("Cleaning directory ...")
154
  clean_directory()
155
 
156
- if user_symptoms is None or (user_symptoms is not None and len(user_symptoms) < 1):
157
- print("Please submit your symptoms first")
158
  return {
159
- error_box_2: gr.update(visible=True, value="Please submit your symptoms first"),
160
  }
161
 
162
- # Key serialization
163
  user_id = np.random.randint(0, 2**32)
 
164
 
165
- client = FHEModelClient(path_dir=MODEL_PATH, key_dir=KEYS_PATH / f"{user_id}")
166
  client.load()
167
 
168
- # The client first need to create the private and evaluation keys.
169
-
170
  client.generate_private_and_evaluation_keys()
171
 
172
  # Get the serialized evaluation keys
173
  serialized_evaluation_keys = client.get_serialized_evaluation_keys()
174
  assert isinstance(serialized_evaluation_keys, bytes)
175
 
176
- # np.save(f".fhe_keys/{user_id}/eval_key.npy", serialized_evaluation_keys)
177
- evaluation_key_path = KEYS_PATH / f"{user_id}/evaluation_key"
178
  with evaluation_key_path.open("wb") as f:
179
  f.write(serialized_evaluation_keys)
180
 
181
  serialized_evaluation_keys_shorten_hex = serialized_evaluation_keys.hex()[:INPUT_BROWSER_LIMIT]
182
 
183
  return {
184
- error_box_2: gr.update(visible=False),
185
- eval_key_textbox: serialized_evaluation_keys_shorten_hex,
186
- user_id_textbox: user_id,
187
- eval_key_len_textbox: f"{len(serialized_evaluation_keys) / (10**6):.2f} MB",
188
  }
189
 
190
 
191
  def encrypt_fn(user_symptoms, user_id):
192
 
193
- if not user_symptoms or not user_symptoms:
 
194
  return {
195
- error_box_3: gr.update(
196
- visible=True, value="Please ensure that the evaluation key has been generated!"
197
  )
198
  }
199
 
200
  # Retrieve the client API
201
-
202
- client = FHEModelClient(path_dir=MODEL_PATH, key_dir=KEYS_PATH / f"{user_id}")
203
  client.load()
204
 
205
  user_symptoms = np.fromstring(user_symptoms[2:-2], dtype=int, sep=".").reshape(1, -1)
206
-
207
  quant_user_symptoms = client.model.quantize_input(user_symptoms)
 
208
  encrypted_quantized_user_symptoms = client.quantize_encrypt_serialize(user_symptoms)
209
  assert isinstance(encrypted_quantized_user_symptoms, bytes)
210
- encrypted_input_path = KEYS_PATH / f"{user_id}/encrypted_symptoms"
211
 
212
  with encrypted_input_path.open("wb") as f:
213
  f.write(encrypted_quantized_user_symptoms)
214
 
215
- # print(client.model.predict(vect_x, fhe="simulate"), client.model.predict(vect_x, fhe="execute"))
216
- # pred_s = client.model.fhe_circuit.simulate(quant_vect)
217
- # pred_fhe = client.model.fhe_circuit.encrypt_run_decrypt(quant_vect) #
218
- # non alpha -> \X1124, base64 ou en exa
219
-
220
- # Compute size
221
-
222
- # np.save(f".fhe_keys/{user_id}/encrypted_quant_vect.npy", encrypted_quantized_user_symptoms)
223
-
224
  encrypted_quantized_user_symptoms_shorten_hex = encrypted_quantized_user_symptoms.hex()[
225
  :INPUT_BROWSER_LIMIT
226
  ]
227
 
228
  return {
229
- error_box_3: gr.update(visible=False),
230
- vect_textbox: user_symptoms,
231
- quant_vect_textbox: quant_user_symptoms,
232
- encrypted_vect_textbox: encrypted_quantized_user_symptoms_shorten_hex,
233
  }
234
 
235
 
236
- def is_nan(input):
237
- return input is None or (input is not None and len(input) < 1)
238
-
239
-
240
  def send_input_fn(user_id, user_symptoms):
241
- """Send the encrypted input image as well as the evaluation key to the server.
242
 
243
  Args:
244
- user_id (int): The current user's ID.
245
- filter_name (str): The current filter to consider.
246
  """
247
- # Get the evaluation key path
248
 
249
  if is_nan(user_id) or is_nan(user_symptoms):
250
  return {
251
- error_box_4: gr.update(
252
  visible=True,
253
  value="Please ensure that the evaluation key has been generated "
254
  "and the symptoms have been submitted before sending the data to the server",
255
  )
256
  }
257
 
258
- evaluation_key_path = KEYS_PATH / f"{user_id}/evaluation_key"
259
- encrypted_input_path = KEYS_PATH / f"{user_id}/encrypted_symptoms"
260
 
261
  if not evaluation_key_path.is_file():
262
- print(f"Please generate the private key, first.{evaluation_key_path.is_file()=}")
 
 
 
263
 
264
- return {
265
- error_box_4: gr.update(visible=True, value="Please generate the private key first.")
266
- }
267
 
268
  if not encrypted_input_path.is_file():
269
- print(f"Please submit your symptoms, first.{encrypted_input_path.is_file()=}")
270
-
 
 
271
  return {
272
- error_box_4: gr.update(
273
  visible=True,
274
- value="Please generate the private key and then encrypt an image first.",
275
- )
276
  }
277
 
278
  # Define the data and files to post
@@ -293,247 +222,411 @@ def send_input_fn(user_id, user_symptoms):
293
  data=data,
294
  files=files,
295
  ) as response:
296
- print(f"response.ok: {response.ok}")
 
297
 
298
- return {error_box_4: gr.update(visible=False), server_response_box: gr.update(visible=True)}
299
 
 
 
300
 
301
- # def decrypt_prediction(encrypted_quantized_vect, user_id):
302
- # fhe_api = FHEModelClient(path_dir=REPO_DIR, key_dir=f".fhe_keys/{user_id}")
303
- # fhe_api.load()
304
- # fhe_api.generate_private_and_evaluation_keys(force=False)
305
- # predictions = fhe_api.deserialize_decrypt_dequantize(encrypted_quantized_vect)
306
- # return predictions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
 
308
 
309
  def clear_all_btn():
 
310
 
311
  clean_directory()
312
 
313
  return {
314
- box_default: None,
315
- vect_textbox: None,
316
- user_id_textbox: None,
317
- eval_key_textbox: None,
318
- quant_vect_textbox: None,
319
- user_vector_textbox: None,
320
- eval_key_len_textbox: None,
321
- encrypted_vect_textbox: None,
322
- error_box_1: gr.update(visible=False),
323
- error_box_2: gr.update(visible=False),
324
- error_box_3: gr.update(visible=False),
325
- error_box_4: gr.update(visible=False),
326
- server_response_box: gr.update(visible=False),
 
 
 
 
 
 
327
  **{box: None for box in check_boxes},
328
  }
329
 
330
 
 
 
 
 
 
 
 
 
 
331
  if __name__ == "__main__":
332
  print("Starting demo ...")
 
333
 
334
- (df_train, X_train, X_test), (df_test, y_train, y_test) = load_data()
335
-
336
- VALID_COLUMNS = X_train.columns.to_list()
337
 
338
- # Load the model
339
- with open("ConcreteXGBoostClassifier.pkl", "r", encoding="utf-8") as file:
340
- concrete_classifier = load(file)
341
 
342
- with gr.Blocks() as demo:
343
 
344
  # Link + images
345
  gr.Markdown(
346
  """
347
- <p align="center">
348
- <img width=200 src="https://user-images.githubusercontent.com/5758427/197816413-d9cddad3-ba38-4793-847d-120975e1da11.png">
349
- </p>
350
-
351
- <h2 align="center">Health Prediction On Encrypted Data Using Homomorphic Encryption.</h2>
352
-
353
- <p align="center">
354
- <a href="https://github.com/zama-ai/concrete-ml"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197972109-faaaff3e-10e2-4ab6-80f5-7531f7cfb08f.png">Concrete-ML</a>
355
-
356
- <a href="https://docs.zama.ai/concrete-ml"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197976802-fddd34c5-f59a-48d0-9bff-7ad1b00cb1fb.png">Documentation</a>
357
-
358
- <a href="https://zama.ai/community"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197977153-8c9c01a7-451a-4993-8e10-5a6ed5343d02.png">Community</a>
359
-
360
- <a href="https://twitter.com/zama_fhe"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197975044-bab9d199-e120-433b-b3be-abd73b211a54.png">@zama_fhe</a>
361
- </p>
362
-
363
- <p align="center">
364
- <img src="https://raw.githubusercontent.com/kcelia/Img/main/demo-img2.png" width="60%" height="60%">
365
- </p>
366
- """
367
  )
368
 
369
- # Gentle introduction
370
- gr.Markdown("## Introduction")
371
- gr.Markdown("""Blablabla""")
372
-
373
- # User symptoms
374
- gr.Markdown("# Step 1: Provide your symptoms")
375
- gr.Markdown("Client side")
376
-
377
- # Default disease, picked from the dataframe
378
- with gr.Row():
379
- default_diseases = list(set(df_test["prognosis"]))
380
- box_default = gr.Dropdown(default_diseases, label="Disease")
381
-
382
- # Box symptoms
383
- check_boxes = []
384
- for i, category in enumerate(SYMPTOMS_LIST):
385
- check_box = gr.CheckboxGroup(
386
- pretty_print(category.values()),
387
- label=pretty_print(category.keys()),
388
- info=f"Symptoms related to `{pretty_print(category.values())}`",
389
- max_batch_size=45,
390
- )
391
- check_boxes.append(check_box)
392
-
393
- error_box_1 = gr.Textbox(label="Error", visible=False)
394
-
395
- # User symptom vector
396
- with gr.Row():
397
- user_vector_textbox = gr.Textbox(
398
- label="User symptoms (vector)",
399
- interactive=False,
400
- max_lines=100,
401
- )
402
-
403
- with gr.Row():
404
- # Submit botton
405
- with gr.Column():
406
- submit_button = gr.Button("Submit")
407
- # Clear botton
408
- with gr.Column():
409
- clear_button = gr.Button("Clear")
410
-
411
- # Click submit botton
412
 
413
- submit_button.click(
414
- fn=get_user_symptoms_vector_fn,
415
- inputs=[box_default, *check_boxes],
416
- outputs=[user_vector_textbox, error_box_1, *check_boxes],
417
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
418
 
419
- gr.Markdown("# Step 2: Generate the keys")
420
- gr.Markdown("Client side")
 
421
 
422
- gen_key_btn = gr.Button("Generate the keys and send public part to server")
 
 
423
 
424
- error_box_2 = gr.Textbox(label="Error", visible=False)
 
 
425
 
426
- with gr.Row():
427
- # User ID
428
- with gr.Column(scale=1, min_width=600):
429
- user_id_textbox = gr.Textbox(
430
- label="User ID:",
431
- max_lines=4,
432
- interactive=False,
433
  )
434
- # Evaluation key size
435
- with gr.Column(scale=1, min_width=600):
436
- eval_key_len_textbox = gr.Textbox(
437
- label="Evaluation key size:", max_lines=4, interactive=False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  )
439
 
440
- with gr.Row():
441
- # Evaluation key (truncated)
442
- with gr.Column(scale=2, min_width=600):
443
- eval_key_textbox = gr.Textbox(
444
- label="Evaluation key (truncated):",
445
- max_lines=4,
446
- interactive=False,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
  )
448
 
449
- gen_key_btn.click(
450
- key_gen_fn,
451
- inputs=user_vector_textbox,
452
- outputs=[eval_key_textbox, user_id_textbox, eval_key_len_textbox, error_box_2],
453
- )
454
 
455
- gr.Markdown("# Step 3: Encode the message with the private key")
456
- gr.Markdown("Client side")
457
 
458
- encrypt_btn = gr.Button("Encode the message with the private key")
 
 
 
 
 
 
459
 
460
- error_box_3 = gr.Textbox(label="Error", visible=False)
 
 
 
 
461
 
462
- with gr.Row():
 
 
463
 
464
- with gr.Column(scale=1, min_width=600):
465
- vect_textbox = gr.Textbox(
466
- label="Vector:",
467
- max_lines=4,
468
- interactive=False,
469
  )
470
 
471
- with gr.Column(scale=1, min_width=600):
472
- quant_vect_textbox = gr.Textbox(
473
- label="Quant vector:", max_lines=4, interactive=False
 
474
  )
475
 
476
- with gr.Column(scale=1, min_width=600):
477
- encrypted_vect_textbox = gr.Textbox(
478
- label="Encrypted vector:", max_lines=4, interactive=False
479
  )
480
 
481
- encrypt_btn.click(
482
- encrypt_fn,
483
- inputs=[user_vector_textbox, user_id_textbox],
484
- outputs=[vect_textbox, quant_vect_textbox, encrypted_vect_textbox, error_box_3],
485
- )
486
-
487
- gr.Markdown("# Step 4: Send the encrypted data to the server.")
488
- gr.Markdown("Client side")
489
-
490
- send_input_btn = gr.Button("Send the encrypted data to the server.")
491
- error_box_4 = gr.Textbox(label="Error", visible=False)
492
- server_response_box = gr.Textbox(value="Data sent", visible=False, show_label=False)
493
-
494
- send_input_btn.click(
495
- send_input_fn,
496
- inputs=[user_id_textbox, user_vector_textbox],
497
- outputs=[error_box_4, server_response_box],
498
- )
499
 
500
- gr.Markdown("# Step 5: Run the FHE evaluation")
501
- gr.Markdown("Server side")
 
 
 
 
 
502
 
503
- run_fhe = gr.Button("Run the FHE evaluation")
 
 
 
 
504
 
505
- gr.Markdown("# Step 6: Decrypt the sentiment")
506
- gr.Markdown("Server side")
 
507
 
508
- decrypt_target_botton = gr.Button("Decrypt the sentiment")
509
- decrypt_target_textbox = gr.Textbox(
510
- label="Encrypted vector:", max_lines=4, interactive=False
511
- )
512
 
513
- # decrypt_target_botton.click(
514
- # decrypt_prediction,
515
- # inputs=[encrypted_vect_textbox, user_id_textbox],
516
- # outputs=[decrypt_target_textbox],
517
- # )
518
 
519
  clear_button.click(
520
  clear_all_btn,
521
  outputs=[
522
- box_default,
523
- error_box_1,
524
- error_box_2,
525
- error_box_3,
526
- error_box_4,
527
- vect_textbox,
528
- user_id_textbox,
529
- eval_key_textbox,
530
- quant_vect_textbox,
531
- user_vector_textbox,
532
- server_response_box,
533
- eval_key_len_textbox,
534
- encrypted_vect_textbox,
 
 
 
 
 
 
535
  *check_boxes,
536
  ],
537
  )
538
 
539
- demo.launch()
 
 
 
1
  import subprocess
2
  import time
3
  from pathlib import Path
4
+ from typing import List, Dict, Tuple, Union
5
 
6
  import gradio as gr
7
  import numpy as np
8
  import pandas as pd
9
  import requests
 
10
  from symptoms_categories import SYMPTOMS_LIST
11
+ from utils import ( # pylint: disable=no-name-in-module
12
+ CLIENT_DIR,
13
+ INPUT_BROWSER_LIMIT,
14
+ KEYS_DIR,
15
+ DEPLOYMENT_DIR,
16
+ CURRENT_DIR,
17
+ SERVER_URL,
18
+ TARGET_COLUMNS,
19
+ TRAINING_FILENAME,
20
+ clean_directory,
21
+ get_disease_name,
22
+ load_data,
23
+ pretty_print,
24
+ )
25
+
26
+ from concrete.ml.deployment import FHEModelClient
27
+
28
+ subprocess.Popen(["uvicorn", "server:app"], cwd=CURRENT_DIR)
 
 
29
  time.sleep(3)
30
 
31
+ # pylint: disable=c-extension-no-member
32
+ def is_nan(inputs):
33
+ return inputs is None or (inputs is not None and len(inputs) < 1)
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ def get_user_symptoms_from_checkboxgroup(checkbox_symptoms) -> np.array:
37
 
38
+ symptoms_vector = {key: 0 for key in valid_columns}
39
 
40
+ for pretty_symptom in checkbox_symptoms:
41
+ original_symptom = "_".join((pretty_symptom.lower().split(" ")))
42
+ if original_symptom not in symptoms_vector.keys():
43
+ raise KeyError(
44
+ f"The symptom '{original_symptom}' you provided is not recognized as a valid "
45
+ f"symptom.\nHere is the list of valid symptoms: {symptoms_vector}"
46
+ )
47
+ symptoms_vector[original_symptom] = 1
 
 
 
 
48
 
49
  user_symptoms_vect = np.fromiter(symptoms_vector.values(), dtype=float)[np.newaxis, :]
50
 
 
53
  return user_symptoms_vect
54
 
55
 
56
+ def fill_in_fn(default_disease, *checkbox_symptoms):
 
 
 
 
 
 
 
 
57
 
58
+ df = pd.read_csv(TRAINING_FILENAME)
59
+ df_filtred = df[df[TARGET_COLUMNS[1]] == default_disease]
60
+ symptoms = pretty_print(df_filtred.columns[df_filtred.eq(1).any()].to_list())
61
 
62
+ if any(lst for lst in checkbox_symptoms if lst):
63
+ for sublist in checkbox_symptoms:
64
+ symptoms.extend(sublist)
 
65
 
66
+ return {box: symptoms for box in check_boxes}
67
 
 
68
 
69
+ def get_features(*checked_symptoms):
70
+ if not any(lst for lst in checked_symptoms if lst):
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  return {
72
+ error_box1: gr.update(
73
  visible=True, value="Enter a default disease or select your own symptoms"
74
  ),
75
  }
 
 
 
 
 
 
76
 
77
+ return {
78
+ error_box1: gr.update(visible=False),
79
+ user_vect_box1: get_user_symptoms_from_checkboxgroup(pretty_print(checked_symptoms)),
80
+ }
81
+
82
+
83
+ def key_gen_fn(user_symptoms: List[str]) -> Dict:
84
+ """
85
+ Generate keys for a given user.
 
86
 
87
+ Args:
88
+ user_symptoms (List[str]): The vector symptoms provided by the user.
89
 
90
+ Returns:
91
+ dict: A dictionary containing the generated keys and related information.
92
 
93
+ """
94
  clean_directory()
95
 
96
+ if is_nan(user_symptoms):
97
+ print("Error: Please submit your symptoms or select a default disease.")
98
  return {
99
+ error_box2: gr.update(visible=True, value="Please submit your symptoms first"),
100
  }
101
 
102
+ # Generate a random user ID
103
  user_id = np.random.randint(0, 2**32)
104
+ print(f"Your user ID is: {user_id}....")
105
 
106
+ client = FHEModelClient(path_dir=DEPLOYMENT_DIR, key_dir=KEYS_DIR / f"{user_id}")
107
  client.load()
108
 
109
+ # Creates the private and evaluation keys on the client side
 
110
  client.generate_private_and_evaluation_keys()
111
 
112
  # Get the serialized evaluation keys
113
  serialized_evaluation_keys = client.get_serialized_evaluation_keys()
114
  assert isinstance(serialized_evaluation_keys, bytes)
115
 
116
+ # Save the evaluation key
117
+ evaluation_key_path = KEYS_DIR / f"{user_id}/evaluation_key"
118
  with evaluation_key_path.open("wb") as f:
119
  f.write(serialized_evaluation_keys)
120
 
121
  serialized_evaluation_keys_shorten_hex = serialized_evaluation_keys.hex()[:INPUT_BROWSER_LIMIT]
122
 
123
  return {
124
+ error_box2: gr.update(visible=False),
125
+ key_box: serialized_evaluation_keys_shorten_hex,
126
+ user_id_box: user_id,
127
+ key_len_box: f"{len(serialized_evaluation_keys) / (10**6):.2f} MB",
128
  }
129
 
130
 
131
  def encrypt_fn(user_symptoms, user_id):
132
 
133
+ if is_nan(user_id) or is_nan(user_symptoms):
134
+ print("Error in encryption step: Provide your symptoms and generate the evaluation keys.")
135
  return {
136
+ error_box3: gr.update(
137
+ visible=True, value="Please provide your symptoms and generate the evaluation keys."
138
  )
139
  }
140
 
141
  # Retrieve the client API
142
+ client = FHEModelClient(path_dir=DEPLOYMENT_DIR, key_dir=KEYS_DIR / f"{user_id}")
 
143
  client.load()
144
 
145
  user_symptoms = np.fromstring(user_symptoms[2:-2], dtype=int, sep=".").reshape(1, -1)
 
146
  quant_user_symptoms = client.model.quantize_input(user_symptoms)
147
+
148
  encrypted_quantized_user_symptoms = client.quantize_encrypt_serialize(user_symptoms)
149
  assert isinstance(encrypted_quantized_user_symptoms, bytes)
150
+ encrypted_input_path = KEYS_DIR / f"{user_id}/encrypted_symptoms"
151
 
152
  with encrypted_input_path.open("wb") as f:
153
  f.write(encrypted_quantized_user_symptoms)
154
 
 
 
 
 
 
 
 
 
 
155
  encrypted_quantized_user_symptoms_shorten_hex = encrypted_quantized_user_symptoms.hex()[
156
  :INPUT_BROWSER_LIMIT
157
  ]
158
 
159
  return {
160
+ error_box3: gr.update(visible=False),
161
+ user_vect_box2: user_symptoms,
162
+ quant_vect_box: quant_user_symptoms,
163
+ enc_vect_box: encrypted_quantized_user_symptoms_shorten_hex,
164
  }
165
 
166
 
 
 
 
 
167
  def send_input_fn(user_id, user_symptoms):
168
+ """Send the encrypted data and the evaluation key to the server.
169
 
170
  Args:
171
+ user_id (int): The current user's ID
172
+ user_symptoms (numpy.ndarray): The user symptoms
173
  """
 
174
 
175
  if is_nan(user_id) or is_nan(user_symptoms):
176
  return {
177
+ error_box4: gr.update(
178
  visible=True,
179
  value="Please ensure that the evaluation key has been generated "
180
  "and the symptoms have been submitted before sending the data to the server",
181
  )
182
  }
183
 
184
+ evaluation_key_path = KEYS_DIR / f"{user_id}/evaluation_key"
185
+ encrypted_input_path = KEYS_DIR / f"{user_id}/encrypted_symptoms"
186
 
187
  if not evaluation_key_path.is_file():
188
+ print(
189
+ "Error Encountered While Sending Data to the Server: "
190
+ f"The key has been generated correctly - {evaluation_key_path.is_file()=}"
191
+ )
192
 
193
+ return {error_box4: gr.update(visible=True, value="Please generate the private key first.")}
 
 
194
 
195
  if not encrypted_input_path.is_file():
196
+ print(
197
+ "Error Encountered While Sending Data to the Server: The data has not been encrypted "
198
+ f"correctly on the client side - {encrypted_input_path.is_file()=}"
199
+ )
200
  return {
201
+ error_box4: gr.update(
202
  visible=True,
203
+ value="Please encrypt the data with the private key first.",
204
+ ),
205
  }
206
 
207
  # Define the data and files to post
 
222
  data=data,
223
  files=files,
224
  ) as response:
225
+ print(f"Sending Data: {response.ok=}")
226
+ return {error_box4: gr.update(visible=False), srv_resp_send_data_box: "Data sent"}
227
 
 
228
 
229
+ def run_fhe_fn(user_id):
230
+ """Send the encrypted input image as well as the evaluation key to the server.
231
 
232
+ Args:
233
+ user_id (int): The current user's ID.
234
+ filter_name (str): The current filter to consider.
235
+ """
236
+ if is_nan(user_id): # or is_nan(user_symptoms):
237
+ return {
238
+ error_box5: gr.update(
239
+ visible=True,
240
+ value="Please ensure that the evaluation key has been generated "
241
+ "and the symptoms have been submitted before sending the data to the server",
242
+ )
243
+ }
244
+
245
+ data = {
246
+ "user_id": user_id,
247
+ }
248
+
249
+ # Trigger the FHE execution on the encrypted image previously sent
250
+
251
+ url = SERVER_URL + "run_fhe"
252
+
253
+ with requests.post(
254
+ url=url,
255
+ data=data,
256
+ ) as response:
257
+ if not response.ok:
258
+ return {
259
+ error_box5: gr.update(visible=True, value="Please wait."),
260
+ fhe_execution_time_box: gr.update(visible=True),
261
+ }
262
+ else:
263
+ print(f"response.ok: {response.ok}, {response.json()} - Computed")
264
+
265
+ return {
266
+ error_box5: gr.update(visible=False),
267
+ fhe_execution_time_box: gr.update(value=f"{response.json()} seconds"),
268
+ }
269
+
270
+
271
+ def get_output_fn(user_id, user_symptoms):
272
+ if is_nan(user_id) or is_nan(user_symptoms):
273
+ return {
274
+ error_box6: gr.update(
275
+ visible=True,
276
+ value="Please ensure that the evaluation key has been generated "
277
+ "and the symptoms have been submitted before sending the data to the server",
278
+ )
279
+ }
280
+
281
+ data = {
282
+ "user_id": user_id,
283
+ }
284
+
285
+ # Retrieve the encrypted output image
286
+ url = SERVER_URL + "get_output"
287
+ with requests.post(
288
+ url=url,
289
+ data=data,
290
+ ) as response:
291
+ if response.ok:
292
+ print(f"Receive Data: {response.ok=}")
293
+
294
+ encrypted_output = response.content
295
+
296
+ # Save the encrypted output to bytes in a file as it is too large to pass through
297
+ # regular Gradio buttons (see https://github.com/gradio-app/gradio/issues/1877)
298
+ encrypted_output_path = CLIENT_DIR / f"{user_id}_encrypted_output"
299
+
300
+ with encrypted_output_path.open("wb") as f:
301
+ f.write(encrypted_output)
302
+ return {error_box6: gr.update(visible=False), srv_resp_retrieve_data_box: "Data received"}
303
+
304
+
305
+ def decrypt_fn(user_id, user_symptoms):
306
+ if is_nan(user_id) or is_nan(user_symptoms):
307
+ return {
308
+ error_box7: gr.update(
309
+ visible=True,
310
+ value="Please ensure that the symptoms have been submitted and the evaluation "
311
+ "key has been generated",
312
+ )
313
+ }
314
+
315
+ # Get the encrypted output path
316
+
317
+ encrypted_output_path = CLIENT_DIR / f"{user_id}_encrypted_output"
318
+
319
+ if not encrypted_output_path.is_file():
320
+ print("Error in decryption step: Please run the FHE execution, first.")
321
+ return {
322
+ error_box7: gr.update(
323
+ visible=True,
324
+ value="Please ensure that the symptoms have been submitted, the evaluation "
325
+ "key has been generated and step 5 and 6 have been performed on the Server "
326
+ "side before decrypting the prediction",
327
+ )
328
+ }
329
+
330
+ # Load the encrypted output as bytes
331
+ with encrypted_output_path.open("rb") as f:
332
+ encrypted_output = f.read()
333
+
334
+ # Retrieve the client API
335
+ client = FHEModelClient(path_dir=DEPLOYMENT_DIR, key_dir=KEYS_DIR / f"{user_id}")
336
+ client.load()
337
+ # Deserialize, decrypt and post-process the encrypted output
338
+ output = client.deserialize_decrypt_dequantize(encrypted_output)
339
+
340
+ return {
341
+ error_box7: gr.update(visible=False),
342
+ decrypt_target_box: get_disease_name(output.argmax()),
343
+ }
344
 
345
 
346
  def clear_all_btn():
347
+ """Clear all the box outputs."""
348
 
349
  clean_directory()
350
 
351
  return {
352
+ disease_box: None,
353
+ user_id_box: None,
354
+ user_vect_box1: None,
355
+ user_vect_box2: None,
356
+ quant_vect_box: None,
357
+ enc_vect_box: None,
358
+ key_box: None,
359
+ key_len_box: None,
360
+ fhe_execution_time_box: None,
361
+ decrypt_target_box: None,
362
+ error_box7: gr.update(visible=False),
363
+ error_box1: gr.update(visible=False),
364
+ error_box2: gr.update(visible=False),
365
+ error_box3: gr.update(visible=False),
366
+ error_box4: gr.update(visible=False),
367
+ error_box5: gr.update(visible=False),
368
+ error_box6: gr.update(visible=False),
369
+ srv_resp_send_data_box: None,
370
+ srv_resp_retrieve_data_box: None,
371
  **{box: None for box in check_boxes},
372
  }
373
 
374
 
375
+ CSS = """
376
+ #them {color: orange}
377
+ #them {font-size: 25px}
378
+ #them {font-weight: bold}
379
+ .gradio-container {background-color: white}
380
+ .feedback {font-size: 3px !important}
381
+ /* #them {text-align: center} */
382
+ """
383
+
384
  if __name__ == "__main__":
385
  print("Starting demo ...")
386
+ clean_directory()
387
 
388
+ (_, X_train, X_test), (df_test, y_train, y_test) = load_data()
 
 
389
 
390
+ valid_columns = X_train.columns.to_list()
 
 
391
 
392
+ with gr.Blocks(css=CSS) as demo:
393
 
394
  # Link + images
395
  gr.Markdown(
396
  """
397
+ <p align="center">
398
+ <img width=200 src="https://user-images.githubusercontent.com/5758427/197816413-d9cddad3-ba38-4793-847d-120975e1da11.png">
399
+ </p>
400
+
401
+ <h2 align="center">Health Prediction On Encrypted Data Using Fully Homomorphic Encryption.</h2>
402
+
403
+ <p align="center">
404
+ <a href="https://github.com/zama-ai/concrete-ml"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197972109-faaaff3e-10e2-4ab6-80f5-7531f7cfb08f.png">Concrete-ML</a>
405
+
406
+ <a href="https://docs.zama.ai/concrete-ml"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197976802-fddd34c5-f59a-48d0-9bff-7ad1b00cb1fb.png">Documentation</a>
407
+
408
+ <a href="https://zama.ai/community"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197977153-8c9c01a7-451a-4993-8e10-5a6ed5343d02.png">Community</a>
409
+
410
+ <a href="https://twitter.com/zama_fhe"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197975044-bab9d199-e120-433b-b3be-abd73b211a54.png">@zama_fhe</a>
411
+ </p>
412
+
413
+ <p align="center">
414
+ <img width="100%" height="30%" src="https://raw.githubusercontent.com/kcelia/Img/main/HEALTHCARE PREDICTION USING MACHINE LEARNING WITH FULLY HOMOMORPHIC ENCRYPTION.png">
415
+ </p>
416
+ """
417
  )
418
 
419
+ with gr.Tabs(elem_id="them"):
420
+ with gr.TabItem("1. Symptoms Selection") as feature:
421
+ gr.Markdown("<span style='color:orange'>Client Side</span>")
422
+ gr.Markdown("## Step 1: Provide your symptoms")
423
+ gr.Markdown(
424
+ "You can provide your health condition either by checking "
425
+ "the symptoms available in the boxes or by selecting a known disease with "
426
+ "its predefined set of symptoms."
427
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
 
429
+ # Box symptoms
430
+ check_boxes = []
431
+ for i, category in enumerate(SYMPTOMS_LIST):
432
+ with gr.Accordion(
433
+ pretty_print(category.keys()), open=True, elem_classes="feedback"
434
+ ):
435
+ check_box = gr.CheckboxGroup(
436
+ pretty_print(category.values()),
437
+ label=pretty_print(category.keys()),
438
+ info=f"Symptoms related to `{pretty_print(category.values())}`",
439
+ )
440
+ check_boxes.append(check_box)
441
+
442
+ error_box1 = gr.Textbox(label="Error", visible=False)
443
+
444
+ # Default disease, picked from the dataframe
445
+ disease_box = gr.Dropdown(list(sorted(set(df_test["prognosis"]))), label="Disease:")
446
+
447
+ disease_box.change(
448
+ fn=fill_in_fn,
449
+ inputs=[disease_box, *check_boxes],
450
+ outputs=[*check_boxes],
451
+ )
452
 
453
+ # User symptom vector
454
+ with gr.Row():
455
+ user_vect_box1 = gr.Textbox(label="User Symptoms Vector:", interactive=False)
456
 
457
+ with gr.Row():
458
+ # Submit botton
459
+ submit_button = gr.Button("Submit")
460
 
461
+ with gr.Row():
462
+ # Clear botton
463
+ clear_button = gr.Button("Reset")
464
 
465
+ submit_button.click(
466
+ fn=get_features,
467
+ inputs=[*check_boxes],
468
+ outputs=[user_vect_box1, error_box1],
 
 
 
469
  )
470
+ with gr.TabItem("2. Data Encryption") as encryption_tab:
471
+ gr.Markdown("<span style='color:orange'>Client Side</span>")
472
+ gr.Markdown("## Step 2: Generate the keys")
473
+
474
+ gen_key_btn = gr.Button("Generate the keys")
475
+ error_box2 = gr.Textbox(label="Error", visible=False)
476
+
477
+ with gr.Row():
478
+ # User ID
479
+ with gr.Column(scale=1, min_width=600):
480
+ user_id_box = gr.Textbox(label="User ID:", interactive=False)
481
+ # Evaluation key size
482
+ with gr.Column(scale=1, min_width=600):
483
+ key_len_box = gr.Textbox(label="Evaluation Key Size:", interactive=False)
484
+
485
+ with gr.Row():
486
+ # Evaluation key (truncated)
487
+ with gr.Column(scale=2, min_width=600):
488
+ key_box = gr.Textbox(
489
+ label="Evaluation key (truncated):",
490
+ max_lines=2,
491
+ interactive=False,
492
+ )
493
+
494
+ gen_key_btn.click(
495
+ key_gen_fn,
496
+ inputs=user_vect_box1,
497
+ outputs=[
498
+ key_box,
499
+ user_id_box,
500
+ key_len_box,
501
+ error_box2,
502
+ ],
503
  )
504
 
505
+ gr.Markdown("## Step 3: Encrypt the symptoms")
506
+
507
+ encrypt_btn = gr.Button("Encrypt the symptoms with the private key")
508
+ error_box3 = gr.Textbox(label="Error", visible=False)
509
+
510
+ with gr.Row():
511
+ with gr.Column(scale=1, min_width=600):
512
+ user_vect_box2 = gr.Textbox(
513
+ label="User Symptoms Vector:", interactive=False
514
+ )
515
+
516
+ with gr.Column(scale=1, min_width=600):
517
+ quant_vect_box = gr.Textbox(label="Quantized Vector:", interactive=False)
518
+
519
+ with gr.Column(scale=1, min_width=600):
520
+ enc_vect_box = gr.Textbox(
521
+ label="Encrypted Vector:", max_lines=3, interactive=False
522
+ )
523
+
524
+ encrypt_btn.click(
525
+ encrypt_fn,
526
+ inputs=[user_vect_box1, user_id_box],
527
+ outputs=[
528
+ user_vect_box2,
529
+ quant_vect_box,
530
+ enc_vect_box,
531
+ error_box3,
532
+ ],
533
  )
534
 
535
+ gr.Markdown(
536
+ "## Step 4: Send the encrypted data to the "
537
+ "<span style='color:orange'>Server Side</span>"
538
+ )
 
539
 
540
+ error_box4 = gr.Textbox(label="Error", visible=False)
 
541
 
542
+ with gr.Row().style(equal_height=False):
543
+ with gr.Column(scale=4):
544
+ send_input_btn = gr.Button("Send the encrypted data")
545
+ with gr.Column(scale=1):
546
+ srv_resp_send_data_box = gr.Checkbox(
547
+ label="Data Sent", show_label=False, interactive=False
548
+ )
549
 
550
+ send_input_btn.click(
551
+ send_input_fn,
552
+ inputs=[user_id_box, user_vect_box1],
553
+ outputs=[error_box4, srv_resp_send_data_box],
554
+ )
555
 
556
+ with gr.TabItem("3. Processing Data") as fhe_tab:
557
+ gr.Markdown("<span style='color:orange'>Client Side</span>")
558
+ gr.Markdown("## Step 5: Run the FHE evaluation")
559
 
560
+ run_fhe_btn = gr.Button("Run the FHE evaluation")
561
+ error_box5 = gr.Textbox(label="Error", visible=False)
562
+ fhe_execution_time_box = gr.Textbox(
563
+ label="Total FHE Execution Time:", interactive=False
 
564
  )
565
 
566
+ run_fhe_btn.click(
567
+ run_fhe_fn,
568
+ inputs=[user_id_box],
569
+ outputs=[fhe_execution_time_box, error_box5],
570
  )
571
 
572
+ gr.Markdown(
573
+ "## Step 6: Get the data from the <span style='color:orange'>Server</span>"
 
574
  )
575
 
576
+ error_box6 = gr.Textbox(label="Error", visible=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
 
578
+ with gr.Row().style(equal_height=True):
579
+ with gr.Column(scale=4):
580
+ get_output_btn = gr.Button("Get data")
581
+ with gr.Column(scale=1):
582
+ srv_resp_retrieve_data_box = gr.Checkbox(
583
+ label="Data Received", show_label=False, interactive=False
584
+ )
585
 
586
+ get_output_btn.click(
587
+ get_output_fn,
588
+ inputs=[user_id_box, user_vect_box1],
589
+ outputs=[srv_resp_retrieve_data_box, error_box6],
590
+ )
591
 
592
+ with gr.TabItem("4. Data Decryption") as decryption_tab:
593
+ gr.Markdown("<span style='color:orange'>Client Side</span>")
594
+ gr.Markdown("## Step 7: Decrypt the output")
595
 
596
+ decrypt_target_btn = gr.Button("Decrypt the output")
597
+ error_box7 = gr.Textbox(label="Error", visible=False)
598
+ decrypt_target_box = gr.Textbox(abel="Decrypted Output:", interactive=False)
 
599
 
600
+ decrypt_target_btn.click(
601
+ decrypt_fn,
602
+ inputs=[user_id_box, user_vect_box1],
603
+ outputs=[decrypt_target_box, error_box7],
604
+ )
605
 
606
  clear_button.click(
607
  clear_all_btn,
608
  outputs=[
609
+ user_vect_box1,
610
+ user_vect_box2,
611
+ disease_box,
612
+ error_box1,
613
+ error_box2,
614
+ error_box3,
615
+ error_box4,
616
+ error_box5,
617
+ error_box6,
618
+ error_box7,
619
+ user_id_box,
620
+ key_len_box,
621
+ key_box,
622
+ quant_vect_box,
623
+ enc_vect_box,
624
+ srv_resp_send_data_box,
625
+ srv_resp_retrieve_data_box,
626
+ fhe_execution_time_box,
627
+ decrypt_target_box,
628
  *check_boxes,
629
  ],
630
  )
631
 
632
+ demo.launch()
data/Testing_preprocessed.csv CHANGED
@@ -1,43 +1,43 @@
1
- itching,skin_rash,nodal_skin_eruptions,continuous_sneezing,shivering,chills,joint_pain,stomach_pain,acidity,ulcers_on_tongue,muscle_wasting,vomiting,burning_micturition,spotting_urination,fatigue,weight_gain,anxiety,cold_hands_and_feets,mood_swings,weight_loss,restlessness,lethargy,patches_in_throat,irregular_sugar_level,cough,high_fever,sunken_eyes,breathlessness,sweating,dehydration,indigestion,headache,yellowish_skin,dark_urine,nausea,loss_of_appetite,pain_behind_the_eyes,back_pain,constipation,abdominal_pain,diarrhoea,mild_fever,yellow_urine,yellowing_of_eyes,acute_liver_failure,fluid_overload,swelling_of_stomach,swelled_lymph_nodes,malaise,blurred_and_distorted_vision,phlegm,throat_irritation,redness_of_eyes,sinus_pressure,runny_nose,congestion,chest_pain,weakness_in_limbs,fast_heart_rate,pain_during_bowel_movements,pain_in_anal_region,bloody_stool,irritation_in_anus,neck_pain,dizziness,cramps,bruising,obesity,swollen_legs,swollen_blood_vessels,puffy_face_and_eyes,enlarged_thyroid,brittle_nails,swollen_extremeties,excessive_hunger,extra_marital_contacts,drying_and_tingling_lips,slurred_speech,knee_pain,hip_joint_pain,muscle_weakness,stiff_neck,swelling_joints,movement_stiffness,spinning_movements,loss_of_balance,unsteadiness,weakness_of_one_body_side,loss_of_smell,bladder_discomfort,foul_smell_of_urine,continuous_feel_of_urine,passage_of_gases,internal_itching,toxic_look_(typhos),depression,irritability,muscle_pain,altered_sensorium,red_spots_over_body,belly_pain,abnormal_menstruation,dischromic_patches,watering_from_eyes,increased_appetite,polyuria,family_history,mucoid_sputum,rusty_sputum,lack_of_concentration,visual_disturbances,receiving_blood_transfusion,receiving_unsterile_injections,coma,stomach_bleeding,distention_of_abdomen,history_of_alcohol_consumption,fluid_overload.1,blood_in_sputum,prominent_veins_on_calf,palpitations,painful_walking,pus_filled_pimples,blackheads,scurving,skin_peeling,silver_like_dusting,small_dents_in_nails,inflammatory_nails,blister,red_sore_around_nose,yellow_crust_ooze,prognosis,y
2
- 1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.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0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,Impetigo,27.0
43
- 1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,Fungal infection,15.0
 
1
+ itching,skin_rash,nodal_skin_eruptions,continuous_sneezing,shivering,chills,joint_pain,stomach_pain,acidity,ulcers_on_tongue,muscle_wasting,vomiting,burning_micturition,spotting_urination,fatigue,weight_gain,anxiety,cold_hands_and_feets,mood_swings,weight_loss,restlessness,lethargy,patches_in_throat,irregular_sugar_level,cough,high_fever,sunken_eyes,breathlessness,sweating,dehydration,indigestion,headache,yellowish_skin,dark_urine,nausea,loss_of_appetite,pain_behind_the_eyes,back_pain,constipation,abdominal_pain,diarrhoea,mild_fever,yellow_urine,yellowing_of_eyes,acute_liver_failure,fluid_overload,swelling_of_stomach,swelled_lymph_nodes,malaise,blurred_and_distorted_vision,phlegm,throat_irritation,redness_of_eyes,sinus_pressure,runny_nose,congestion,chest_pain,weakness_in_limbs,fast_heart_rate,pain_during_bowel_movements,pain_in_anal_region,bloody_stool,irritation_in_anus,neck_pain,dizziness,cramps,bruising,obesity,swollen_legs,swollen_blood_vessels,puffy_face_and_eyes,enlarged_thyroid,brittle_nails,swollen_extremeties,excessive_hunger,extra_marital_contacts,drying_and_tingling_lips,slurred_speech,knee_pain,hip_joint_pain,muscle_weakness,stiff_neck,swelling_joints,movement_stiffness,spinning_movements,loss_of_balance,unsteadiness,weakness_of_one_body_side,loss_of_smell,bladder_discomfort,foul_smell_of_urine,continuous_feel_of_urine,passage_of_gases,internal_itching,toxic_look_(typhos),depression,irritability,muscle_pain,altered_sensorium,red_spots_over_body,belly_pain,abnormal_menstruation,dischromic_patches,watering_from_eyes,increased_appetite,polyuria,family_history,mucoid_sputum,rusty_sputum,lack_of_concentration,visual_disturbances,receiving_blood_transfusion,receiving_unsterile_injections,coma,stomach_bleeding,distention_of_abdomen,history_of_alcohol_consumption,fluid_overload.1,blood_in_sputum,prominent_veins_on_calf,palpitations,painful_walking,pus_filled_pimples,blackheads,scurving,skin_peeling,silver_like_dusting,small_dents_in_nails,inflammatory_nails,blister,red_sore_around_nose,yellow_crust_ooze,prognosis,prognosis_encoded
2
+ 1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.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0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,Fungal Infection,14.0
data/Training_preprocessed.csv CHANGED
The diff for this file is too large to render. See raw diff
 
preprocessing.py CHANGED
@@ -7,8 +7,14 @@ Preliminary preprocessing on the data, such as:
7
  import pandas as pd
8
  from sklearn import preprocessing
9
 
10
- COLUMNS_TO_DROP = ["Unnamed: 133"]
11
- TARGET_COLUMN = ["prognosis"]
 
 
 
 
 
 
12
  RENAME_COLUMNS = {
13
  "scurring": "scurving",
14
  "dischromic _patches": "dischromic_patches",
@@ -16,68 +22,48 @@ RENAME_COLUMNS = {
16
  "foul_smell_of urine": "foul_smell_of_urine",
17
  }
18
 
19
-
20
- def pretty_print(input):
21
- """
22
- Prettify the input.
23
-
24
- Args:
25
- input: Can be a list of symtoms or a disease.
26
-
27
- Returns:
28
- list: Sorted and prettified input.
29
- """
30
- # Convert to a list if necessary
31
- if isinstance(input, list):
32
- input = list(input)
33
-
34
- # Flatten the list if required
35
- pretty_list = []
36
- for item in input:
37
- if isinstance(item, list):
38
- pretty_list.extend(item)
39
- else:
40
- pretty_list.append(item)
41
-
42
- # Sort and prettify the input
43
- pretty_list = sorted([" ".join((item.split("_"))).title() for item in pretty_list])
44
-
45
- return pretty_list
46
-
47
-
48
- def map_prediction(target_columns=["y", "prognosis"]):
49
- df = pd.read_csv("Training_preprocessed.csv")
50
- relevent_df = df[target_columns].drop_duplicates().relevent_df.where(df["y"] == 1)
51
- prediction = relevent_df[target_columns[1]].dropna().values[0]
52
- return prediction
53
-
54
 
55
  if __name__ == "__main__":
56
 
57
  # Load data
58
- df_train = pd.read_csv("Training.csv")
59
- df_test = pd.read_csv("Testing.csv")
60
 
61
  # Remove unseless columns
62
- df_train.drop(columns=COLUMNS_TO_DROP, axis=1, errors="ignore", inplace=True)
63
- df_test.drop(columns=COLUMNS_TO_DROP, axis=1, errors="ignore", inplace=True)
64
 
65
  # Correct some typos in some columns name
66
  df_train.rename(columns=RENAME_COLUMNS, inplace=True)
67
  df_test.rename(columns=RENAME_COLUMNS, inplace=True)
68
 
69
- # Convert y category labels to y
 
 
 
 
 
 
70
  label_encoder = preprocessing.LabelEncoder()
71
- label_encoder.fit(df_train[TARGET_COLUMN].values.flatten())
72
 
73
- df_train["y"] = label_encoder.transform(df_train[TARGET_COLUMN].values.flatten())
74
- df_test["y"] = label_encoder.transform(df_test[TARGET_COLUMN].values.flatten())
 
 
 
 
75
 
76
  # Cast X features from int64 to float32
77
- float_columns = df_train.columns.drop(TARGET_COLUMN)
78
  df_train[float_columns] = df_train[float_columns].astype("float32")
79
  df_test[float_columns] = df_test[float_columns].astype("float32")
80
 
81
  # Save preprocessed data
82
- df_train.to_csv(path_or_buf="Training_preprocessed.csv", index=False)
83
- df_test.to_csv(path_or_buf="Testing_preprocessed.csv", index=False)
 
7
  import pandas as pd
8
  from sklearn import preprocessing
9
 
10
+ # Files location
11
+ TRAINING_FILE_NAME = "./data/Training.csv"
12
+ TESTING_FILE_NAME = "./data/Testing.csv"
13
+
14
+ # Columns processing
15
+ TARGET_COLUMN = "prognosis"
16
+ DROP_COLUMNS = ["Unnamed: 133"]
17
+
18
  RENAME_COLUMNS = {
19
  "scurring": "scurving",
20
  "dischromic _patches": "dischromic_patches",
 
22
  "foul_smell_of urine": "foul_smell_of_urine",
23
  }
24
 
25
+ RENAME_VALUES = {
26
+ "(vertigo) Paroymsal Positional Vertigo": "Paroymsal Positional Vertigo",
27
+ "Dimorphic hemmorhoids(piles)": "Dimorphic hemmorhoids (piles)",
28
+ "Peptic ulcer diseae": "Peptic Ulcer",
29
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  if __name__ == "__main__":
32
 
33
  # Load data
34
+ df_train = pd.read_csv(TRAINING_FILE_NAME)
35
+ df_test = pd.read_csv(TESTING_FILE_NAME)
36
 
37
  # Remove unseless columns
38
+ df_train.drop(columns=DROP_COLUMNS, axis=1, errors="ignore", inplace=True)
39
+ df_test.drop(columns=DROP_COLUMNS, axis=1, errors="ignore", inplace=True)
40
 
41
  # Correct some typos in some columns name
42
  df_train.rename(columns=RENAME_COLUMNS, inplace=True)
43
  df_test.rename(columns=RENAME_COLUMNS, inplace=True)
44
 
45
+ df_train[TARGET_COLUMN].replace(RENAME_VALUES.keys(), RENAME_VALUES.values(), inplace=True)
46
+ df_train[TARGET_COLUMN] = df_train[TARGET_COLUMN].apply(str.title)
47
+
48
+ df_test[TARGET_COLUMN].replace(RENAME_VALUES.keys(), RENAME_VALUES.values(), inplace=True)
49
+ df_test[TARGET_COLUMN] = df_test[TARGET_COLUMN].apply(str.title)
50
+
51
+ # Convert the `TARGET_COLUMN` to a numeric label
52
  label_encoder = preprocessing.LabelEncoder()
53
+ label_encoder.fit(df_train[[TARGET_COLUMN]].values.flatten())
54
 
55
+ df_train[f"{TARGET_COLUMN}_encoded"] = label_encoder.transform(
56
+ df_train[[TARGET_COLUMN]].values.flatten()
57
+ )
58
+ df_test[f"{TARGET_COLUMN}_encoded"] = label_encoder.transform(
59
+ df_test[[TARGET_COLUMN]].values.flatten()
60
+ )
61
 
62
  # Cast X features from int64 to float32
63
+ float_columns = df_train.columns.drop([TARGET_COLUMN])
64
  df_train[float_columns] = df_train[float_columns].astype("float32")
65
  df_test[float_columns] = df_test[float_columns].astype("float32")
66
 
67
  # Save preprocessed data
68
+ df_train.to_csv(path_or_buf="./data/Training_preprocessed.csv", index=False)
69
+ df_test.to_csv(path_or_buf="./data/Testing_preprocessed.csv", index=False)
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- concrete-ml==1.0.0
2
  gradio==3.11.0
3
  uvicorn>=0.21.0
4
  fastapi>=0.93.0
 
1
+ concrete-ml==1.0.3
2
  gradio==3.11.0
3
  uvicorn>=0.21.0
4
  fastapi>=0.93.0
server.py CHANGED
@@ -1,44 +1,40 @@
1
  """Server that will listen for GET and POST requests from the client."""
2
 
3
  import time
4
- from pathlib import Path
5
  from typing import List
6
 
7
  from fastapi import FastAPI, File, Form, UploadFile
8
  from fastapi.responses import JSONResponse, Response
 
9
 
10
  from concrete.ml.deployment import FHEModelServer
11
 
12
- REPO_DIR = Path(__file__).parent
13
- KEYS_PATH = REPO_DIR / ".fhe_keys"
14
- MODEL_PATH = REPO_DIR / "client_folder"
15
-
16
- SERVER_TMP_PATH = REPO_DIR / "server_tmp"
17
  # Initialize an instance of FastAPI
18
  app = FastAPI()
19
 
20
- current_dir = Path(__file__).parent
21
-
22
- # Load the model
23
- fhe_model = FHEModelServer(Path.joinpath(current_dir, "./client_folder"))
24
-
25
  # Define the default route
26
  @app.get("/")
27
  def root():
28
- return {"message": "Welcome to Your disease prediction with fhe !"}
 
 
 
 
 
 
29
 
30
 
31
  @app.post("/send_input")
32
  def send_input(
33
  user_id: str = Form(),
34
- filter: str = Form(),
35
  files: List[UploadFile] = File(),
36
  ):
37
-
38
  """Send the inputs to the server."""
39
- # Retrieve the encrypted input image and the evaluation key paths
40
- evaluation_key_path = SERVER_TMP_PATH / f"{user_id}_valuation_key"
41
- encrypted_input_path = SERVER_TMP_PATH / f"{user_id}_encrypted_symptoms"
 
 
42
 
43
  # # Write the files using the above paths
44
  with encrypted_input_path.open("wb") as encrypted_input, evaluation_key_path.open(
@@ -48,51 +44,54 @@ def send_input(
48
  evaluation_key.write(files[1].file.read())
49
 
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
- # @app.post("/run_fhe")
53
- # def run_fhe(
54
- # user_id: str = Form(),
55
- # filter: str = Form(),
56
- # ):
57
- # """Execute the filter on the encrypted input image using FHE."""
58
- # Retrieve the encrypted input image and the evaluation key paths
59
- # encrypted_image_path = get_server_file_path("encrypted_image", user_id, filter)
60
- # evaluation_key_path = get_server_file_path("evaluation_key", user_id, filter)
61
 
62
- # Read the files using the above paths
63
- # with encrypted_image_path.open("rb") as encrypted_image_file, evaluation_key_path.open(
64
- # "rb"
65
- # ) as evaluation_key_file:
66
- # encrypted_image = encrypted_image_file.read()
67
- # evaluation_key = evaluation_key_file.read()
68
 
69
- # Load the FHE server
70
- # fhe_server = FHEServer(FILTERS_PATH / f"{filter}/deployment")
 
71
 
72
- # Run the FHE execution
73
- # start = time.time()
74
- # encrypted_output_image = fhe_server.run(encrypted_image, evaluation_key)
75
- # fhe_execution_time = round(time.time() - start, 2)
76
 
77
- # Retrieve the encrypted output image path
78
- # encrypted_output_path = get_server_file_path("encrypted_output", user_id, filter)
79
 
80
- # Write the file using the above path
81
- # with encrypted_output_path.open("wb") as encrypted_output:
82
- # encrypted_output.write(encrypted_output_image)
83
 
84
- # return JSONResponse(content=fhe_execution_time)
 
 
85
 
 
 
 
86
 
87
- # @app.post("/get_output")
88
- # def get_output(
89
- # user_id: str = Form(),
90
- # filter: str = Form(),
91
- # ):
92
- # """Retrieve the encrypted output image."""
93
- # Retrieve the encrypted output image path
94
- # encrypted_output_path = get_server_file_path("encrypted_output", user_id, filter)
95
 
96
- # Read the file using the above path
97
- # with encrypted_output_path.open("rb") as encrypted_output_file:
98
- # encrypted_output = encrypted_output_file.read()
 
1
  """Server that will listen for GET and POST requests from the client."""
2
 
3
  import time
 
4
  from typing import List
5
 
6
  from fastapi import FastAPI, File, Form, UploadFile
7
  from fastapi.responses import JSONResponse, Response
8
+ from utils import DEPLOYMENT_DIR, SERVER_DIR # pylint: disable=no-name-in-module)
9
 
10
  from concrete.ml.deployment import FHEModelServer
11
 
 
 
 
 
 
12
  # Initialize an instance of FastAPI
13
  app = FastAPI()
14
 
 
 
 
 
 
15
  # Define the default route
16
  @app.get("/")
17
  def root():
18
+ """
19
+ Root endpoint of the health prediction API.
20
+
21
+ Returns:
22
+ dict: The welcome message.
23
+ """
24
+ return {"message": "Welcome to your disease prediction with FHE!"}
25
 
26
 
27
  @app.post("/send_input")
28
  def send_input(
29
  user_id: str = Form(),
 
30
  files: List[UploadFile] = File(),
31
  ):
 
32
  """Send the inputs to the server."""
33
+
34
+ print("\nSend the data to the server ............\n")
35
+ # Retrieve the encrypted input and the evaluation key paths
36
+ evaluation_key_path = SERVER_DIR / f"{user_id}_valuation_key"
37
+ encrypted_input_path = SERVER_DIR / f"{user_id}_encrypted_symptoms"
38
 
39
  # # Write the files using the above paths
40
  with encrypted_input_path.open("wb") as encrypted_input, evaluation_key_path.open(
 
44
  evaluation_key.write(files[1].file.read())
45
 
46
 
47
+ @app.post("/run_fhe")
48
+ def run_fhe(
49
+ user_id: str = Form(),
50
+ ):
51
+ """Inference in FHE."""
52
+
53
+ print("\nRun in FHE in the server ............\n")
54
+ evaluation_key_path = SERVER_DIR / f"{user_id}_valuation_key"
55
+ encrypted_input_path = SERVER_DIR / f"{user_id}_encrypted_symptoms"
56
+
57
+ # Read the files using the above paths
58
+ with encrypted_input_path.open("rb") as encrypted_output_file, evaluation_key_path.open(
59
+ "rb"
60
+ ) as evaluation_key_file:
61
+ encrypted_output = encrypted_output_file.read()
62
+ evaluation_key = evaluation_key_file.read()
63
+
64
+ # Load the FHE server and the model
65
+ fhe_server = FHEModelServer(DEPLOYMENT_DIR)
66
 
67
+ # Run the FHE execution
68
+ start = time.time()
69
+ encrypted_output = fhe_server.run(encrypted_output, evaluation_key)
70
+ assert isinstance(encrypted_output, bytes)
71
+ fhe_execution_time = round(time.time() - start, 2)
 
 
 
 
72
 
73
+ # Retrieve the encrypted output path
74
+ encrypted_output_path = SERVER_DIR / f"{user_id}_encrypted_output"
 
 
 
 
75
 
76
+ # Write the file using the above path
77
+ with encrypted_output_path.open("wb") as f:
78
+ f.write(encrypted_output)
79
 
80
+ return JSONResponse(content=fhe_execution_time)
 
 
 
81
 
 
 
82
 
83
+ @app.post("/get_output")
84
+ def get_output(user_id: str = Form()):
85
+ """Retrieve the encrypted output."""
86
 
87
+ print("\nGet the output from the server ............\n")
88
+ # Retrieve the encrypted output path
89
+ encrypted_output_path = SERVER_DIR / f"{user_id}_encrypted_output"
90
 
91
+ # Read the file using the above path
92
+ with encrypted_output_path.open("rb") as f:
93
+ encrypted_output = f.read()
94
 
95
+ time.sleep(1)
 
 
 
 
 
 
 
96
 
97
+ return Response(encrypted_output)
 
 
symptoms_categories.py CHANGED
@@ -7,12 +7,8 @@ Each variable contains a list of symptoms sthat can be pecific to a part of the
7
  of similar symptoms.
8
  """
9
 
10
- import itertools
11
-
12
- import pandas as pd
13
-
14
  DIGESTIVE_SYSTEM_SYPTOMS = {
15
- "Digestive system syptoms": [
16
  "stomach_pain",
17
  "acidity",
18
  "vomiting",
@@ -38,7 +34,7 @@ DIGESTIVE_SYSTEM_SYPTOMS = {
38
  }
39
 
40
  SKIN_SYPTOMS = {
41
- "Skin related symptoms": [
42
  "itching",
43
  "skin_rash",
44
  "pus_filled_pimples",
@@ -57,8 +53,8 @@ SKIN_SYPTOMS = {
57
  ]
58
  }
59
 
60
- ORL_SYPTOMS = {
61
- "ORL_SYPTOMS": [
62
  "loss_of_smell",
63
  "continuous_sneezing",
64
  "runny_nose",
@@ -148,7 +144,7 @@ MUSCULOSKELETAL_SYMPTOMS = {
148
  }
149
 
150
  FEELING_SYMPTOMS = {
151
- "FEELING_SYPTOMS": [
152
  "anxiety",
153
  "restlessness",
154
  "lethargy",
@@ -167,8 +163,8 @@ FEELING_SYMPTOMS = {
167
  ]
168
  }
169
 
170
- OTHER_SYPTOMS = {
171
- "OTHER_SYPTOMS": [
172
  "ulcers_on_tongue",
173
  "shivering",
174
  "chills",
@@ -201,7 +197,7 @@ PATIENT_HISTORY = {
201
  SYMPTOMS_LIST = [
202
  SKIN_SYPTOMS,
203
  EYES_SYMPTOMS,
204
- ORL_SYPTOMS,
205
  THORAX_SYMPTOMS,
206
  DIGESTIVE_SYSTEM_SYPTOMS,
207
  UROLOGICAL_SYMPTOMS,
@@ -209,18 +205,5 @@ SYMPTOMS_LIST = [
209
  MUSCULOSKELETAL_SYMPTOMS,
210
  FEELING_SYMPTOMS,
211
  PATIENT_HISTORY,
212
- OTHER_SYPTOMS,
213
  ]
214
-
215
-
216
- def test(file_path="./Training.csv"):
217
- df = pd.read_csv(file_path, index_col=0)
218
- valid_column = df.columns
219
- all_symptoms = [category.values() for category in SYMPTOMS_LIST]
220
- all_symptoms = list(itertools.chain.from_iterable(all_symptoms))
221
- all_symptoms = list(itertools.chain.from_iterable(all_symptoms))
222
- set(valid_column) - set(all_symptoms), set(all_symptoms) - set(valid_column)
223
-
224
-
225
- if __name__ == "__main__":
226
- test()
 
7
  of similar symptoms.
8
  """
9
 
 
 
 
 
10
  DIGESTIVE_SYSTEM_SYPTOMS = {
11
+ "Digestive_system_symptoms": [
12
  "stomach_pain",
13
  "acidity",
14
  "vomiting",
 
34
  }
35
 
36
  SKIN_SYPTOMS = {
37
+ "Skin_related_symptoms": [
38
  "itching",
39
  "skin_rash",
40
  "pus_filled_pimples",
 
53
  ]
54
  }
55
 
56
+ ORL_SYMPTOMS = {
57
+ "ORL_SYMPTOMS": [
58
  "loss_of_smell",
59
  "continuous_sneezing",
60
  "runny_nose",
 
144
  }
145
 
146
  FEELING_SYMPTOMS = {
147
+ "FEELING_SYMPTOMS": [
148
  "anxiety",
149
  "restlessness",
150
  "lethargy",
 
163
  ]
164
  }
165
 
166
+ OTHER_SYMPTOMS = {
167
+ "OTHER_SYMPTOMS": [
168
  "ulcers_on_tongue",
169
  "shivering",
170
  "chills",
 
197
  SYMPTOMS_LIST = [
198
  SKIN_SYPTOMS,
199
  EYES_SYMPTOMS,
200
+ ORL_SYMPTOMS,
201
  THORAX_SYMPTOMS,
202
  DIGESTIVE_SYSTEM_SYPTOMS,
203
  UROLOGICAL_SYMPTOMS,
 
205
  MUSCULOSKELETAL_SYMPTOMS,
206
  FEELING_SYMPTOMS,
207
  PATIENT_HISTORY,
208
+ OTHER_SYMPTOMS,
209
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
utils.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import shutil
3
+ from pathlib import Path
4
+ from typing import Any, List, Tuple
5
+
6
+ import numpy
7
+ import pandas
8
+
9
+ from concrete.ml.sklearn import XGBClassifier as ConcreteXGBoostClassifier
10
+
11
+ # Max Input to be displayed on the HuggingFace space brower using Gradio
12
+ # Too large inputs, slow down the server: https://github.com/gradio-app/gradio/issues/1877
13
+ INPUT_BROWSER_LIMIT = 635
14
+
15
+ # Store the server's URL
16
+ SERVER_URL = "http://localhost:8000/"
17
+
18
+ CURRENT_DIR = Path(__file__).parent
19
+ DEPLOYMENT_DIR = CURRENT_DIR / "deployment"
20
+ KEYS_DIR = DEPLOYMENT_DIR / ".fhe_keys"
21
+ CLIENT_DIR = DEPLOYMENT_DIR / "client"
22
+ SERVER_DIR = DEPLOYMENT_DIR / "server"
23
+
24
+ ALL_DIRS = [KEYS_DIR, CLIENT_DIR, SERVER_DIR]
25
+
26
+ # Columns that define the target
27
+ TARGET_COLUMNS = ["prognosis_encoded", "prognosis"]
28
+
29
+ TRAINING_FILENAME = "./data/Training_preprocessed.csv"
30
+ TESTING_FILENAME = "./data/Testing_preprocessed.csv"
31
+
32
+ # pylint: disable=invalid-name
33
+
34
+
35
+ def pretty_print(inputs):
36
+ """
37
+ Prettify and sort the input as a list of string.
38
+
39
+ Args:
40
+ inputs (Any): The inputs to be prettified.
41
+
42
+ Returns:
43
+ List: The prettified and sorted list of inputs.
44
+
45
+ """
46
+ # Convert to a list if necessary
47
+ if not isinstance(inputs, (List, Tuple)):
48
+ inputs = list(inputs)
49
+
50
+ # Flatten the list if required
51
+ pretty_list = []
52
+ for item in inputs:
53
+ if isinstance(item, list):
54
+ pretty_list.extend([" ".join(subitem.split("_")).title() for subitem in item])
55
+ else:
56
+ pretty_list.append(" ".join(item.split("_")).title())
57
+
58
+ # Sort and prettify the input
59
+ pretty_list = sorted(list(set(pretty_list)))
60
+
61
+ return pretty_list
62
+
63
+
64
+ def clean_directory() -> None:
65
+ """
66
+ Clear direcgtories
67
+ """
68
+ print("Cleaning...\n")
69
+ for target_dir in ALL_DIRS:
70
+ if os.path.exists(target_dir) and os.path.isdir(target_dir):
71
+ shutil.rmtree(target_dir)
72
+ target_dir.mkdir(exist_ok=True)
73
+
74
+
75
+ def get_disease_name(encoded_prediction: int, file_name: str = TRAINING_FILENAME) -> str:
76
+ """Return the disease name given its encoded label.
77
+
78
+ Args:
79
+ encoded_prediction (int): The encoded prediction
80
+ file_name (str): The data file path
81
+
82
+ Returns:
83
+ str: The according disease name
84
+ """
85
+ df = pandas.read_csv(file_name, usecols=TARGET_COLUMNS).drop_duplicates()
86
+ disease_name, _ = df[df[TARGET_COLUMNS[0]] == encoded_prediction].values.flatten()
87
+ return disease_name
88
+
89
+
90
+ def load_data() -> Tuple[pandas.DataFrame, pandas.DataFrame, numpy.ndarray]:
91
+ """
92
+ Return the data
93
+
94
+ Args:
95
+ None
96
+
97
+ Return:
98
+ Tuple[pandas.DataFrame, pandas.DataFrame, numpy.ndarray]: The train and testing set.
99
+
100
+
101
+ """
102
+ # Load data
103
+ df_train = pandas.read_csv(TRAINING_FILENAME)
104
+ df_test = pandas.read_csv(TESTING_FILENAME)
105
+
106
+ # Separate the traget from the training / testing set:
107
+ # TARGET_COLUMNS[0] -> "prognosis_encoded" -> contains the numeric label of the disease
108
+ # TARGET_COLUMNS[1] -> "prognosis" -> contains the name of the disease
109
+
110
+ y_train = df_train[TARGET_COLUMNS[0]]
111
+ X_train = df_train.drop(columns=TARGET_COLUMNS, axis=1, errors="ignore")
112
+
113
+ y_test = df_test[TARGET_COLUMNS[0]]
114
+ X_test = df_test.drop(columns=TARGET_COLUMNS, axis=1, errors="ignore")
115
+
116
+ return (df_train, X_train, X_test), (df_test, y_train, y_test)
117
+
118
+
119
+ def load_model(X_train: pandas.DataFrame, y_train: numpy.ndarray):
120
+ """
121
+ Load a pretrained serialized model
122
+
123
+ Args:
124
+ X_train (pandas.DataFrame): Training set
125
+ y_train (numpy.ndarray): Targets of the training set
126
+
127
+ Return:
128
+ The Concrete ML model and its circuit
129
+ """
130
+ # Parameters
131
+ concrete_args = {"max_depth": 1, "n_bits": 3, "n_estimators": 3, "n_jobs": -1}
132
+ classifier = ConcreteXGBoostClassifier(**concrete_args)
133
+ # Train the model
134
+ classifier.fit(X_train, y_train)
135
+ # Compile the model
136
+ circuit = classifier.compile(X_train)
137
+
138
+ return classifier, circuit