Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
chore: remove emoji
Browse files
app.py
CHANGED
@@ -124,7 +124,7 @@ def get_features_fn(*checked_symptoms: Tuple[str]) -> Dict:
|
|
124 |
visible=False,
|
125 |
value=get_user_symptoms_from_checkboxgroup(pretty_print(checked_symptoms)),
|
126 |
),
|
127 |
-
submit_button: gr.update(value="Data Submitted β
"),
|
128 |
}
|
129 |
|
130 |
|
@@ -202,7 +202,7 @@ def encrypt_fn(user_symptoms: np.ndarray, user_id: str) -> None:
|
|
202 |
client.load()
|
203 |
|
204 |
user_symptoms = np.fromstring(user_symptoms[2:-2], dtype=int, sep=".").reshape(1, -1)
|
205 |
-
quant_user_symptoms = client.model.quantize_input(user_symptoms)
|
206 |
|
207 |
encrypted_quantized_user_symptoms = client.quantize_encrypt_serialize(user_symptoms)
|
208 |
assert isinstance(encrypted_quantized_user_symptoms, bytes)
|
@@ -535,7 +535,7 @@ if __name__ == "__main__":
|
|
535 |
</p>
|
536 |
|
537 |
<p align="center">
|
538 |
-
<img width="
|
539 |
</p>
|
540 |
"""
|
541 |
)
|
@@ -583,7 +583,7 @@ if __name__ == "__main__":
|
|
583 |
|
584 |
with gr.Row():
|
585 |
with gr.Column(scale=2):
|
586 |
-
disease_box = gr.Dropdown(sorted(diseases), label="Diseases
|
587 |
with gr.Column(scale=5):
|
588 |
default_symptoms = gr.Textbox(
|
589 |
label="Related Symptoms:", visible=True, interactive=False
|
@@ -596,10 +596,10 @@ if __name__ == "__main__":
|
|
596 |
with gr.Row():
|
597 |
with gr.Column():
|
598 |
# Submit botton
|
599 |
-
submit_button = gr.Button("Submit Symptoms
|
600 |
with gr.Column():
|
601 |
# Clear botton
|
602 |
-
clear_button = gr.Button("Reset Space π")
|
603 |
|
604 |
# ------------------------- Step 2 -------------------------
|
605 |
gr.Markdown("## Step 2: Encrypt data")
|
@@ -611,7 +611,7 @@ if __name__ == "__main__":
|
|
611 |
"The evaluation key will be transmitted to the server for further processing."
|
612 |
)
|
613 |
|
614 |
-
gen_key_btn = gr.Button("Generate the evaluation key
|
615 |
error_box2 = gr.Textbox(label="Error β", visible=False)
|
616 |
user_id_box = gr.Textbox(label="User ID:", interactive=False, visible=True)
|
617 |
key_len_box = gr.Textbox(
|
@@ -626,7 +626,7 @@ if __name__ == "__main__":
|
|
626 |
|
627 |
gr.Markdown("### Encrypt the data")
|
628 |
|
629 |
-
encrypt_btn = gr.Button("Encrypt the data using the
|
630 |
error_box3 = gr.Textbox(label="Error β", visible=False)
|
631 |
quant_vect_box = gr.Textbox(
|
632 |
label="Quantized Vector:",
|
@@ -666,7 +666,7 @@ if __name__ == "__main__":
|
|
666 |
|
667 |
with gr.Row().style(equal_height=False):
|
668 |
with gr.Column(scale=4):
|
669 |
-
send_input_btn = gr.Button("Send the encrypted data
|
670 |
with gr.Column(scale=1):
|
671 |
srv_resp_send_data_box = gr.Checkbox(
|
672 |
label="Data Sent", show_label=False, interactive=False
|
@@ -687,7 +687,7 @@ if __name__ == "__main__":
|
|
687 |
"This server employs a [logistic regression]() model that has been trained on this [data-set](https://github.com/anujdutt9/Disease-Prediction-from-Symptoms/tree/master/dataset)."
|
688 |
)
|
689 |
|
690 |
-
run_fhe_btn = gr.Button("Run the FHE evaluation
|
691 |
error_box5 = gr.Textbox(label="Error β", visible=False)
|
692 |
fhe_execution_time_box = gr.Textbox(
|
693 |
label="Total FHE Execution Time:", interactive=False, visible=True
|
@@ -710,7 +710,7 @@ if __name__ == "__main__":
|
|
710 |
|
711 |
with gr.Row().style(equal_height=True):
|
712 |
with gr.Column(scale=4):
|
713 |
-
get_output_btn = gr.Button("Get data
|
714 |
with gr.Column(scale=1):
|
715 |
srv_resp_retrieve_data_box = gr.Checkbox(
|
716 |
label="Data Received", show_label=False, interactive=False
|
@@ -725,7 +725,7 @@ if __name__ == "__main__":
|
|
725 |
gr.Markdown("### Decrypt the output")
|
726 |
|
727 |
decrypt_target_btn = gr.Button(
|
728 |
-
"Decrypt the output with the
|
729 |
)
|
730 |
error_box7 = gr.Textbox(label="Error β", visible=False)
|
731 |
decrypt_target_box = gr.Textbox(label="Decrypted Output:", interactive=False)
|
|
|
124 |
visible=False,
|
125 |
value=get_user_symptoms_from_checkboxgroup(pretty_print(checked_symptoms)),
|
126 |
),
|
127 |
+
submit_button: gr.update(value="Data Submitted β
β"),
|
128 |
}
|
129 |
|
130 |
|
|
|
202 |
client.load()
|
203 |
|
204 |
user_symptoms = np.fromstring(user_symptoms[2:-2], dtype=int, sep=".").reshape(1, -1)
|
205 |
+
#quant_user_symptoms = client.model.quantize_input(user_symptoms)
|
206 |
|
207 |
encrypted_quantized_user_symptoms = client.quantize_encrypt_serialize(user_symptoms)
|
208 |
assert isinstance(encrypted_quantized_user_symptoms, bytes)
|
|
|
535 |
</p>
|
536 |
|
537 |
<p align="center">
|
538 |
+
<img width="65%" height="20%" src="https://raw.githubusercontent.com/kcelia/Img/main/hf_space_3_health_prediction_cover_image.png">
|
539 |
</p>
|
540 |
"""
|
541 |
)
|
|
|
583 |
|
584 |
with gr.Row():
|
585 |
with gr.Column(scale=2):
|
586 |
+
disease_box = gr.Dropdown(sorted(diseases), label="Diseases")
|
587 |
with gr.Column(scale=5):
|
588 |
default_symptoms = gr.Textbox(
|
589 |
label="Related Symptoms:", visible=True, interactive=False
|
|
|
596 |
with gr.Row():
|
597 |
with gr.Column():
|
598 |
# Submit botton
|
599 |
+
submit_button = gr.Button("Submit Symptoms")
|
600 |
with gr.Column():
|
601 |
# Clear botton
|
602 |
+
clear_button = gr.Button("Reset Space π β»")
|
603 |
|
604 |
# ------------------------- Step 2 -------------------------
|
605 |
gr.Markdown("## Step 2: Encrypt data")
|
|
|
611 |
"The evaluation key will be transmitted to the server for further processing."
|
612 |
)
|
613 |
|
614 |
+
gen_key_btn = gr.Button("Generate the evaluation key")
|
615 |
error_box2 = gr.Textbox(label="Error β", visible=False)
|
616 |
user_id_box = gr.Textbox(label="User ID:", interactive=False, visible=True)
|
617 |
key_len_box = gr.Textbox(
|
|
|
626 |
|
627 |
gr.Markdown("### Encrypt the data")
|
628 |
|
629 |
+
encrypt_btn = gr.Button("Encrypt the data using the private secret key")
|
630 |
error_box3 = gr.Textbox(label="Error β", visible=False)
|
631 |
quant_vect_box = gr.Textbox(
|
632 |
label="Quantized Vector:",
|
|
|
666 |
|
667 |
with gr.Row().style(equal_height=False):
|
668 |
with gr.Column(scale=4):
|
669 |
+
send_input_btn = gr.Button("Send the encrypted data")
|
670 |
with gr.Column(scale=1):
|
671 |
srv_resp_send_data_box = gr.Checkbox(
|
672 |
label="Data Sent", show_label=False, interactive=False
|
|
|
687 |
"This server employs a [logistic regression]() model that has been trained on this [data-set](https://github.com/anujdutt9/Disease-Prediction-from-Symptoms/tree/master/dataset)."
|
688 |
)
|
689 |
|
690 |
+
run_fhe_btn = gr.Button("Run the FHE evaluation")
|
691 |
error_box5 = gr.Textbox(label="Error β", visible=False)
|
692 |
fhe_execution_time_box = gr.Textbox(
|
693 |
label="Total FHE Execution Time:", interactive=False, visible=True
|
|
|
710 |
|
711 |
with gr.Row().style(equal_height=True):
|
712 |
with gr.Column(scale=4):
|
713 |
+
get_output_btn = gr.Button("Get data")
|
714 |
with gr.Column(scale=1):
|
715 |
srv_resp_retrieve_data_box = gr.Checkbox(
|
716 |
label="Data Received", show_label=False, interactive=False
|
|
|
725 |
gr.Markdown("### Decrypt the output")
|
726 |
|
727 |
decrypt_target_btn = gr.Button(
|
728 |
+
"Decrypt the output with the private secret decryption key"
|
729 |
)
|
730 |
error_box7 = gr.Textbox(label="Error β", visible=False)
|
731 |
decrypt_target_box = gr.Textbox(label="Decrypted Output:", interactive=False)
|