mariotawfik commited on
Commit
48085e3
Β·
1 Parent(s): 2920351
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -346,29 +346,32 @@ if __name__ == "__main__":
346
  b_decrypt_result = gr.Button("πŸ” Decrypt scan result")
347
 
348
  scan_result = gr.Textbox(label="Scan Result:")
349
-
 
350
  # Button for key generation
351
- b_gen_key.click(fn=keygen, inputs=[eval_key], outputs=[evaluation_key])
352
 
 
353
  # Button to extract vector
354
  b_extract.click(
355
  fn=encode_quantize,
356
- inputs=[file_input, eval_key, encodings],
357
  outputs=[extracted_vector],
358
  )
359
 
360
  # Button to encrypt file
361
  b_encrypt_file.click(
362
  fn=encrypt_encoded_quantize,
363
- inputs=[encodings],
364
  outputs=[encrypted_file],
365
  )
366
 
 
367
  # Button to run FHE-based malware scan
368
- b_run_fhe_scan.click(fn=run_fhe, inputs=[eval_key[1]], outputs=[encrypted_scan_result])
369
 
370
  # Button to decrypt the scan result
371
- b_decrypt_result.click(fn=decrypt_prediction(), inputs=[eval_key[1]], outputs=[scan_result])
372
 
373
  gr.Markdown(
374
  "ClairVault is built using advanced Fully Homomorphic Encryption techniques to ensure your data remains private and secure throughout the entire malware scanning process."
 
346
  b_decrypt_result = gr.Button("πŸ” Decrypt scan result")
347
 
348
  scan_result = gr.Textbox(label="Scan Result:")
349
+
350
+ eval_key_input = gr.Textbox(value=eval_key)
351
  # Button for key generation
352
+ b_gen_key.click(fn=keygen, inputs=[eval_key_input], outputs=[evaluation_key])
353
 
354
+ encodings_input = gr.Textbox(value=encodings)
355
  # Button to extract vector
356
  b_extract.click(
357
  fn=encode_quantize,
358
+ inputs=[file_input, eval_key, encodings_input],
359
  outputs=[extracted_vector],
360
  )
361
 
362
  # Button to encrypt file
363
  b_encrypt_file.click(
364
  fn=encrypt_encoded_quantize,
365
+ inputs=[extracted_vector],
366
  outputs=[encrypted_file],
367
  )
368
 
369
+ eval_key_part_input = gr.Textbox(value=eval_key[1])
370
  # Button to run FHE-based malware scan
371
+ b_run_fhe_scan.click(fn=run_fhe, inputs=[eval_key_part_input], outputs=[encrypted_scan_result])
372
 
373
  # Button to decrypt the scan result
374
+ b_decrypt_result.click(fn=decrypt_prediction(), inputs=[eval_key_part_input], outputs=[scan_result])
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."