Spaces:
Runtime error
Runtime error
Commit
·
dfd9163
1
Parent(s):
4a2b240
app
Browse files
app.py
CHANGED
@@ -47,6 +47,8 @@ N_USER_KEY_STORED = 20
|
|
47 |
eval_key = []
|
48 |
#Encodings vector
|
49 |
encodings = []
|
|
|
|
|
50 |
|
51 |
def clean_tmp_directory():
|
52 |
# Allow 20 user keys to be stored.
|
@@ -87,6 +89,7 @@ def keygen(eval_key):
|
|
87 |
numpy.save(f"tmp/tmp_evaluation_key_{user_id}.npy", evaluation_key)
|
88 |
|
89 |
eval_key = [list(evaluation_key)[:ENCRYPTED_DATA_BROWSER_LIMIT], user_id]
|
|
|
90 |
|
91 |
|
92 |
def encode_quantize(test_file, eval_key, encodings):
|
@@ -366,12 +369,12 @@ if __name__ == "__main__":
|
|
366 |
outputs=[encrypted_file],
|
367 |
)
|
368 |
|
369 |
-
|
370 |
# Button to run FHE-based malware scan
|
371 |
-
b_run_fhe_scan.click(fn=run_fhe, inputs=[
|
372 |
|
373 |
# Button to decrypt the scan result
|
374 |
-
b_decrypt_result.click(fn=decrypt_prediction(), inputs=[
|
375 |
|
376 |
gr.Markdown(
|
377 |
"ClairVault is built using advanced Fully Homomorphic Encryption techniques to ensure your data remains private and secure throughout the entire malware scanning process."
|
|
|
47 |
eval_key = []
|
48 |
#Encodings vector
|
49 |
encodings = []
|
50 |
+
#User ID
|
51 |
+
user_id = []
|
52 |
|
53 |
def clean_tmp_directory():
|
54 |
# Allow 20 user keys to be stored.
|
|
|
89 |
numpy.save(f"tmp/tmp_evaluation_key_{user_id}.npy", evaluation_key)
|
90 |
|
91 |
eval_key = [list(evaluation_key)[:ENCRYPTED_DATA_BROWSER_LIMIT], user_id]
|
92 |
+
user_id = eval_key[1]
|
93 |
|
94 |
|
95 |
def encode_quantize(test_file, eval_key, encodings):
|
|
|
369 |
outputs=[encrypted_file],
|
370 |
)
|
371 |
|
372 |
+
user_id_input = gr.Textbox(value=user_id)
|
373 |
# Button to run FHE-based malware scan
|
374 |
+
b_run_fhe_scan.click(fn=run_fhe, inputs=[user_id_input], outputs=[encrypted_scan_result])
|
375 |
|
376 |
# Button to decrypt the scan result
|
377 |
+
b_decrypt_result.click(fn=decrypt_prediction(), inputs=[user_id_input], outputs=[scan_result])
|
378 |
|
379 |
gr.Markdown(
|
380 |
"ClairVault is built using advanced Fully Homomorphic Encryption techniques to ensure your data remains private and secure throughout the entire malware scanning process."
|