Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -111,6 +111,8 @@ def encode_quantize_encrypt(test_file, eval_key):
|
|
| 111 |
# expect [1, 53] but we get (53)
|
| 112 |
# pdb.set_trace()
|
| 113 |
# features = pickle.loads(open(os.path.join("features.pkl"), "rb").read())
|
|
|
|
|
|
|
| 114 |
encodings = extract_infos(test_file)
|
| 115 |
|
| 116 |
encodings = list(map(lambda x: encodings[x], ugly))
|
|
@@ -190,11 +192,34 @@ def process_pipeline(test_file):
|
|
| 190 |
return eval_key, encodings, encrypted_quantized_encoding, encrypted_prediction
|
| 191 |
|
| 192 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
with gr.Blocks() as demo:
|
| 195 |
print("Starting the FHE Model")
|
| 196 |
|
| 197 |
-
|
| 198 |
inputs = (
|
| 199 |
[
|
| 200 |
gr.File(label="Test File"),
|
|
@@ -211,4 +236,14 @@ if __name__ == "__main__":
|
|
| 211 |
title = ("FHE Model",)
|
| 212 |
description = ("This is a FHE Model",)
|
| 213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
demo.launch() #share=True)
|
|
|
|
| 111 |
# expect [1, 53] but we get (53)
|
| 112 |
# pdb.set_trace()
|
| 113 |
# features = pickle.loads(open(os.path.join("features.pkl"), "rb").read())
|
| 114 |
+
|
| 115 |
+
|
| 116 |
encodings = extract_infos(test_file)
|
| 117 |
|
| 118 |
encodings = list(map(lambda x: encodings[x], ugly))
|
|
|
|
| 192 |
return eval_key, encodings, encrypted_quantized_encoding, encrypted_prediction
|
| 193 |
|
| 194 |
if __name__ == "__main__":
|
| 195 |
+
"""
|
| 196 |
+
with gr.Blocks() as demo:
|
| 197 |
+
print("Starting the FHE Model")
|
| 198 |
+
|
| 199 |
+
inputs = [gr.File(label="Test File")]
|
| 200 |
+
outputs = [
|
| 201 |
+
gr.Textbox(label="Evaluation Key"),
|
| 202 |
+
gr.Textbox(label="Encodings"),
|
| 203 |
+
gr.Textbox(label="Encrypted Quantized Encoding"),
|
| 204 |
+
gr.Textbox(label="Encrypted Prediction"),
|
| 205 |
+
]
|
| 206 |
+
|
| 207 |
+
run_bottn = gr.Button(label="Run")
|
| 208 |
+
|
| 209 |
+
run_bottn.click(
|
| 210 |
+
fn=process_pipeline, # Pass process_pipeline directly
|
| 211 |
+
inputs=inputs,
|
| 212 |
+
outputs=outputs
|
| 213 |
+
)
|
| 214 |
|
| 215 |
+
demo.launch()
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
"""
|
| 219 |
with gr.Blocks() as demo:
|
| 220 |
print("Starting the FHE Model")
|
| 221 |
|
| 222 |
+
|
| 223 |
inputs = (
|
| 224 |
[
|
| 225 |
gr.File(label="Test File"),
|
|
|
|
| 236 |
title = ("FHE Model",)
|
| 237 |
description = ("This is a FHE Model",)
|
| 238 |
|
| 239 |
+
#gr.Interface(fn, inputs, outputs, title=title, description=description).launch()
|
| 240 |
+
|
| 241 |
+
run_bottn = gr.Button(label="Run ")
|
| 242 |
+
|
| 243 |
+
run_bottn.click(
|
| 244 |
+
fn=(process_pipeline,),
|
| 245 |
+
inputs=inputs, outputs=outputs
|
| 246 |
+
)
|
| 247 |
+
|
| 248 |
+
|
| 249 |
demo.launch() #share=True)
|