Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
chore: update
Browse files
app.py
CHANGED
@@ -469,15 +469,15 @@ def reset_fn():
|
|
469 |
return {
|
470 |
one_hot_vector_box: None,
|
471 |
submit_btn: gr.update(value="Submit"),
|
472 |
-
user_id_box: gr.update(visible=False, value=None
|
473 |
one_hot_vector: None,
|
474 |
default_symptoms: gr.update(visible=True, value=None),
|
475 |
disease_box: gr.update(visible=True, value=None),
|
476 |
-
quant_vect_box: gr.update(visible=False, value=None
|
477 |
-
enc_vect_box: gr.update(visible=True, value=None
|
478 |
-
key_box: gr.update(visible=True, value=None
|
479 |
-
key_len_box: gr.update(visible=False, value=None
|
480 |
-
fhe_execution_time_box: gr.update(visible=True, value=None
|
481 |
decrypt_box: None,
|
482 |
error_box7: gr.update(visible=False),
|
483 |
error_box1: gr.update(visible=False),
|
@@ -535,6 +535,7 @@ if __name__ == "__main__":
|
|
535 |
)
|
536 |
|
537 |
# ------------------------- Step 1 -------------------------
|
|
|
538 |
gr.Markdown("## Step 1: Select chief complaints")
|
539 |
gr.Markdown("<hr />")
|
540 |
gr.Markdown("<span style='color:grey'>Client Side</span>")
|
@@ -568,9 +569,7 @@ if __name__ == "__main__":
|
|
568 |
with gr.Column(scale=2):
|
569 |
disease_box = gr.Dropdown(sorted(diseases), label="Diseases", visible=False)
|
570 |
with gr.Column(scale=5):
|
571 |
-
default_symptoms = gr.Textbox(
|
572 |
-
label="Related Symptoms:", interactive=False, visible=False,
|
573 |
-
)
|
574 |
# User vector symptoms encoded in oneHot representation
|
575 |
one_hot_vector = gr.Textbox(visible=False)
|
576 |
# Submit botton
|
@@ -588,6 +587,7 @@ if __name__ == "__main__":
|
|
588 |
)
|
589 |
|
590 |
# ------------------------- Step 2 -------------------------
|
|
|
591 |
gr.Markdown("## Step 2: Encrypt data")
|
592 |
gr.Markdown("<hr />")
|
593 |
gr.Markdown("<span style='color:grey'>Client Side</span>")
|
@@ -656,12 +656,13 @@ if __name__ == "__main__":
|
|
656 |
)
|
657 |
|
658 |
# ------------------------- Step 3 -------------------------
|
|
|
659 |
gr.Markdown("## Step 3: Run the FHE evaluation")
|
660 |
gr.Markdown("<hr />")
|
661 |
gr.Markdown("<span style='color:grey'>Server Side</span>")
|
662 |
gr.Markdown(
|
663 |
"Once the server receives the encrypted data, it can process and compute the output without ever decrypting the data just as it would on clear data.\n\n"
|
664 |
-
"This server employs a [
|
665 |
)
|
666 |
|
667 |
run_fhe_btn = gr.Button("Run the FHE evaluation")
|
@@ -674,6 +675,7 @@ if __name__ == "__main__":
|
|
674 |
)
|
675 |
|
676 |
# ------------------------- Step 4 -------------------------
|
|
|
677 |
gr.Markdown("## Step 4: Decrypt the data")
|
678 |
gr.Markdown("<hr />")
|
679 |
gr.Markdown("<span style='color:grey'>Client Side</span>")
|
@@ -686,9 +688,7 @@ if __name__ == "__main__":
|
|
686 |
with gr.Column(scale=4):
|
687 |
get_output_btn = gr.Button("Get data")
|
688 |
with gr.Column(scale=1):
|
689 |
-
srv_resp_retrieve_data_box = gr.Checkbox(
|
690 |
-
label="Data Received", show_label=False, interactive=False
|
691 |
-
)
|
692 |
|
693 |
get_output_btn.click(
|
694 |
get_output_fn,
|
@@ -700,7 +700,7 @@ if __name__ == "__main__":
|
|
700 |
gr.Markdown("### Decrypt the output")
|
701 |
decrypt_btn = gr.Button("Decrypt the output using the private secret key")
|
702 |
error_box7 = gr.Textbox(label="Error ❌", visible=False)
|
703 |
-
decrypt_box = gr.Textbox(label="Decrypted Output:"
|
704 |
|
705 |
decrypt_btn.click(
|
706 |
decrypt_fn,
|
|
|
469 |
return {
|
470 |
one_hot_vector_box: None,
|
471 |
submit_btn: gr.update(value="Submit"),
|
472 |
+
user_id_box: gr.update(visible=False, value=None),
|
473 |
one_hot_vector: None,
|
474 |
default_symptoms: gr.update(visible=True, value=None),
|
475 |
disease_box: gr.update(visible=True, value=None),
|
476 |
+
quant_vect_box: gr.update(visible=False, value=None),
|
477 |
+
enc_vect_box: gr.update(visible=True, value=None),
|
478 |
+
key_box: gr.update(visible=True, value=None),
|
479 |
+
key_len_box: gr.update(visible=False, value=None),
|
480 |
+
fhe_execution_time_box: gr.update(visible=True, value=None),
|
481 |
decrypt_box: None,
|
482 |
error_box7: gr.update(visible=False),
|
483 |
error_box1: gr.update(visible=False),
|
|
|
535 |
)
|
536 |
|
537 |
# ------------------------- Step 1 -------------------------
|
538 |
+
gr.Markdown("\n")
|
539 |
gr.Markdown("## Step 1: Select chief complaints")
|
540 |
gr.Markdown("<hr />")
|
541 |
gr.Markdown("<span style='color:grey'>Client Side</span>")
|
|
|
569 |
with gr.Column(scale=2):
|
570 |
disease_box = gr.Dropdown(sorted(diseases), label="Diseases", visible=False)
|
571 |
with gr.Column(scale=5):
|
572 |
+
default_symptoms = gr.Textbox(label="Related Symptoms:", visible=False)
|
|
|
|
|
573 |
# User vector symptoms encoded in oneHot representation
|
574 |
one_hot_vector = gr.Textbox(visible=False)
|
575 |
# Submit botton
|
|
|
587 |
)
|
588 |
|
589 |
# ------------------------- Step 2 -------------------------
|
590 |
+
gr.Markdown("\n")
|
591 |
gr.Markdown("## Step 2: Encrypt data")
|
592 |
gr.Markdown("<hr />")
|
593 |
gr.Markdown("<span style='color:grey'>Client Side</span>")
|
|
|
656 |
)
|
657 |
|
658 |
# ------------------------- Step 3 -------------------------
|
659 |
+
gr.Markdown("\n")
|
660 |
gr.Markdown("## Step 3: Run the FHE evaluation")
|
661 |
gr.Markdown("<hr />")
|
662 |
gr.Markdown("<span style='color:grey'>Server Side</span>")
|
663 |
gr.Markdown(
|
664 |
"Once the server receives the encrypted data, it can process and compute the output without ever decrypting the data just as it would on clear data.\n\n"
|
665 |
+
"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)."
|
666 |
)
|
667 |
|
668 |
run_fhe_btn = gr.Button("Run the FHE evaluation")
|
|
|
675 |
)
|
676 |
|
677 |
# ------------------------- Step 4 -------------------------
|
678 |
+
gr.Markdown("\n")
|
679 |
gr.Markdown("## Step 4: Decrypt the data")
|
680 |
gr.Markdown("<hr />")
|
681 |
gr.Markdown("<span style='color:grey'>Client Side</span>")
|
|
|
688 |
with gr.Column(scale=4):
|
689 |
get_output_btn = gr.Button("Get data")
|
690 |
with gr.Column(scale=1):
|
691 |
+
srv_resp_retrieve_data_box = gr.Checkbox(label="Data Received", show_label=False)
|
|
|
|
|
692 |
|
693 |
get_output_btn.click(
|
694 |
get_output_fn,
|
|
|
700 |
gr.Markdown("### Decrypt the output")
|
701 |
decrypt_btn = gr.Button("Decrypt the output using the private secret key")
|
702 |
error_box7 = gr.Textbox(label="Error ❌", visible=False)
|
703 |
+
decrypt_box = gr.Textbox(label="Decrypted Output:")
|
704 |
|
705 |
decrypt_btn.click(
|
706 |
decrypt_fn,
|