Spaces:
Runtime error
Runtime error
Update app.py
Browse files128 unmodified lines1291301311321331341352 unmodified lines138139140141142143144204 unmodified lines34935035135235335435511 unmodified lines367368369370371372373374375376377128 unmodified linesreturn encodingsdef encrypt_encoded_quantize(encodings):fhe_api = FHEModelClient(f"fhe_model", f".fhe_keys/{eval_key}")fhe_api.load()2 unmodified linesencrypted_quantized_encoding = fhe_api.quantize_encrypt_serialize(encodings)numpy.save(f"tmp/tmp_encrypted_quantized_encoding_{eval_key[1]}.npy",encrypted_quantized_encoding,)204 unmodified lines"The encrypted scan result is sent back to the client, who can finally decrypt it with their private key. Only the client is aware of the original file content and the scan result.")b_decrypt_result = gr.Button("๐ Decrypt scan result")scan_result = gr.Textbox(label="Scan Result:")eval_key_input = gr.Textbox(value=eval_key)11 unmodified lines# Button to encrypt fileb_encrypt_file.click(fn=encrypt_encoded_quantize,inputs=[extracted_vector],outputs=[encrypted_file],)user_id_input = gr.Textbox(value=user_id)# Button to run FHE-based malware scanb_run_fhe_scan.click(fn=run_fhe, inputs=[user_id_input], outputs=[encrypted_scan_result])128 unmodified lines1291301311321331341352 unmodified lines138139140141142143144204 unmodified lines34935035135235335435511 unmodified lines367368369370371372373374375376128 unmodified linesreturn encodingsdef encrypt_encoded_quantize(encodings, user_id, eval_key):fhe_api = FHEModelClient(f"fhe_model", f".fhe_keys/{eval_key}")fhe_api.load()2 unmodified linesencrypted_quantized_encoding = fhe_api.quantize_encrypt_serialize(encodings)numpy.save(f"tmp/tmp_encrypted_quantized_encoding_{user_id}.npy",encrypted_quantized_encoding,)204 unmodified lines"The encrypted scan result is sent back to the client, who can finally decrypt it with their private key. Only the client is aware of the original file content and the scan result.")b_decrypt_result = gr.Button("๐ Decrypt scan result")user_id_input = gr.Textbox(value=user_id)scan_result = gr.Textbox(label="Scan Result:")eval_key_input = gr.Textbox(value=eval_key)11 unmodified lines# Button to encrypt fileb_encrypt_file.click(fn=encrypt_encoded_quantize,inputs=[extracted_vector, user_id_input, eval_key_input],outputs=[encrypted_file],)# Button to run FHE-based malware scanb_run_fhe_scan.click(fn=run_fhe, inputs=[user_id_input], outputs=[encrypted_scan_result])
app.py+4-5