Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -169,12 +169,9 @@ def decrypt_prediction(user_id):
|
|
169 |
predictions = fhe_api.deserialize_decrypt_dequantize(encrypted_prediction)
|
170 |
|
171 |
|
172 |
-
if __name__ == "__main__":
|
173 |
-
import gradio as gr
|
174 |
-
|
175 |
|
176 |
-
def process_pipeline(
|
177 |
-
eval_key = keygen(
|
178 |
encodings = encode_quantize_encrypt(test_file, eval_key)
|
179 |
encrypted_quantized_encoding = run_fhe(encodings)
|
180 |
encrypted_prediction = decrypt_prediction(encrypted_quantized_encoding)
|
@@ -182,13 +179,11 @@ def process_pipeline(task, test_file, user_id):
|
|
182 |
return eval_key, encodings, encrypted_quantized_encoding, encrypted_prediction
|
183 |
|
184 |
if __name__ == "__main__":
|
185 |
-
|
186 |
app = gr.Interface(
|
187 |
fn=process_pipeline,
|
188 |
inputs=[
|
189 |
-
gr.Textbox(label="Task", value="malware"),
|
190 |
gr.File(label="Test File"),
|
191 |
-
gr.Textbox(label="User ID"),
|
192 |
],
|
193 |
outputs=[
|
194 |
gr.Textbox(label="Evaluation Key"),
|
@@ -200,4 +195,4 @@ if __name__ == "__main__":
|
|
200 |
description="This is a FHE Model",
|
201 |
)
|
202 |
|
203 |
-
app.launch()
|
|
|
169 |
predictions = fhe_api.deserialize_decrypt_dequantize(encrypted_prediction)
|
170 |
|
171 |
|
|
|
|
|
|
|
172 |
|
173 |
+
def process_pipeline(test_file, user_id):
|
174 |
+
eval_key = keygen(user_id)
|
175 |
encodings = encode_quantize_encrypt(test_file, eval_key)
|
176 |
encrypted_quantized_encoding = run_fhe(encodings)
|
177 |
encrypted_prediction = decrypt_prediction(encrypted_quantized_encoding)
|
|
|
179 |
return eval_key, encodings, encrypted_quantized_encoding, encrypted_prediction
|
180 |
|
181 |
if __name__ == "__main__":
|
182 |
+
|
183 |
app = gr.Interface(
|
184 |
fn=process_pipeline,
|
185 |
inputs=[
|
|
|
186 |
gr.File(label="Test File"),
|
|
|
187 |
],
|
188 |
outputs=[
|
189 |
gr.Textbox(label="Evaluation Key"),
|
|
|
195 |
description="This is a FHE Model",
|
196 |
)
|
197 |
|
198 |
+
app.launch(share=True)
|