Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
mariotawfik
commited on
Commit
β’
88ea699
1
Parent(s):
d3e7e7e
Update app.py
Browse files
app.py
CHANGED
@@ -79,7 +79,7 @@ def keygen(eval_key, user_id):
|
|
79 |
print("Initializing FHEModelClient...")
|
80 |
# Let's create a user_id
|
81 |
user_id = numpy.random.randint(0, 2**32)
|
82 |
-
fhe_api = FHEModelClient(f"fhe_model", f".fhe_keys/{
|
83 |
fhe_api.load()
|
84 |
|
85 |
# Generate a fresh key
|
@@ -129,7 +129,7 @@ def encode_quantize(test_file, eval_key, encodings):
|
|
129 |
return encodings
|
130 |
|
131 |
def encrypt_encoded_quantize(encodings, user_id, eval_key):
|
132 |
-
fhe_api = FHEModelClient(f"fhe_model", f".fhe_keys/{
|
133 |
fhe_api.load()
|
134 |
|
135 |
encodings = np.array(encodings)
|
@@ -348,7 +348,7 @@ if __name__ == "__main__":
|
|
348 |
"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."
|
349 |
)
|
350 |
b_decrypt_result = gr.Button("π Decrypt scan result")
|
351 |
-
user_id_input = gr.
|
352 |
scan_result = gr.Textbox(label="Scan Result:")
|
353 |
|
354 |
eval_key_input = gr.Textbox(value=eval_key, visible=False)
|
|
|
79 |
print("Initializing FHEModelClient...")
|
80 |
# Let's create a user_id
|
81 |
user_id = numpy.random.randint(0, 2**32)
|
82 |
+
fhe_api = FHEModelClient(f"fhe_model", f".fhe_keys/{user_id}")
|
83 |
fhe_api.load()
|
84 |
|
85 |
# Generate a fresh key
|
|
|
129 |
return encodings
|
130 |
|
131 |
def encrypt_encoded_quantize(encodings, user_id, eval_key):
|
132 |
+
fhe_api = FHEModelClient(f"fhe_model", f".fhe_keys/{user_id}")
|
133 |
fhe_api.load()
|
134 |
|
135 |
encodings = np.array(encodings)
|
|
|
348 |
"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."
|
349 |
)
|
350 |
b_decrypt_result = gr.Button("π Decrypt scan result")
|
351 |
+
user_id_input = gr.Number(value=user_id, visible=False)
|
352 |
scan_result = gr.Textbox(label="Scan Result:")
|
353 |
|
354 |
eval_key_input = gr.Textbox(value=eval_key, visible=False)
|