Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
chore: update img and delete files
Browse files- app.py +24 -16
- deployment/client.zip +0 -0
- deployment/server.zip +0 -0
- deployment/versions.json +0 -1
- deployment_logit_12/client.zip +0 -0
- deployment_logit_12/server.zip +0 -0
- deployment_logit_12/versions.json +0 -1
- deployment_logit_13/client.zip +0 -0
- deployment_logit_13/server.zip +0 -0
- deployment_logit_13/versions.json +0 -1
- deployment_xgb/client.zip +0 -0
- deployment_xgb/server.zip +0 -0
- deployment_xgb/versions.json +0 -1
app.py
CHANGED
@@ -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)
|
@@ -457,7 +457,7 @@ def decrypt_fn(
|
|
457 |
return {
|
458 |
error_box7: gr.update(visible=False),
|
459 |
decrypt_box: out,
|
460 |
-
submit_btn: gr.update(value="Submit")
|
461 |
}
|
462 |
|
463 |
|
@@ -522,13 +522,13 @@ if __name__ == "__main__":
|
|
522 |
</p>
|
523 |
|
524 |
<p align="center">
|
525 |
-
<img width="65%" height="20%" src="https://raw.githubusercontent.com/kcelia/Img/main/
|
526 |
</p>
|
527 |
"""
|
528 |
)
|
529 |
gr.Markdown("## Notes")
|
530 |
gr.Markdown(
|
531 |
-
|
532 |
- The private key is used to encrypt and decrypt the data and shall never be shared.
|
533 |
- The evaluation key is a public key that the server needs to process encrypted data.
|
534 |
"""
|
@@ -563,7 +563,10 @@ if __name__ == "__main__":
|
|
563 |
error_box1 = gr.Textbox(label="Error β", visible=False)
|
564 |
|
565 |
# Default disease, picked from the dataframe
|
566 |
-
gr.Markdown(
|
|
|
|
|
|
|
567 |
|
568 |
with gr.Row():
|
569 |
with gr.Column(scale=2):
|
@@ -575,10 +578,11 @@ if __name__ == "__main__":
|
|
575 |
# Submit botton
|
576 |
submit_btn = gr.Button("Submit")
|
577 |
# Clear botton
|
578 |
-
clear_button = gr.Button("Reset Space π", visible=False)
|
579 |
-
|
580 |
-
disease_box.change(fn=display_default_symptoms_fn, inputs=[disease_box], outputs=[default_symptoms])
|
581 |
|
|
|
|
|
|
|
582 |
|
583 |
submit_btn.click(
|
584 |
fn=get_features_fn,
|
@@ -602,9 +606,9 @@ if __name__ == "__main__":
|
|
602 |
gen_key_btn = gr.Button("Generate the evaluation key")
|
603 |
error_box2 = gr.Textbox(label="Error β", visible=False)
|
604 |
user_id_box = gr.Textbox(label="User ID:", visible=True)
|
605 |
-
key_len_box = gr.Textbox(label="Evaluation Key Size:",
|
606 |
key_box = gr.Textbox(label="Evaluation key (truncated):", max_lines=3, visible=False)
|
607 |
-
|
608 |
gen_key_btn.click(
|
609 |
key_gen_fn,
|
610 |
inputs=one_hot_vector,
|
@@ -679,7 +683,9 @@ if __name__ == "__main__":
|
|
679 |
gr.Markdown("## Step 4: Decrypt the data")
|
680 |
gr.Markdown("<hr />")
|
681 |
gr.Markdown("<span style='color:grey'>Client Side</span>")
|
682 |
-
gr.Markdown(
|
|
|
|
|
683 |
|
684 |
error_box6 = gr.Textbox(label="Error β", visible=False)
|
685 |
|
@@ -707,21 +713,23 @@ if __name__ == "__main__":
|
|
707 |
inputs=[user_id_box, one_hot_vector, *check_boxes],
|
708 |
outputs=[decrypt_box, error_box7, submit_btn],
|
709 |
)
|
710 |
-
|
711 |
# ------------------------- End -------------------------
|
712 |
-
|
713 |
gr.Markdown(
|
714 |
"""The app was built with [Concrete ML](https://github.com/zama-ai/concrete-ml), a Privacy-Preserving Machine Learning (PPML) open-source set of tools by Zama.
|
715 |
Try it yourself and don't forget to star on [Github](https://github.com/zama-ai/concrete-ml) β.
|
716 |
-
"""
|
|
|
717 |
|
718 |
gr.Markdown("\n\n")
|
719 |
|
720 |
gr.Markdown(
|
721 |
-
|
722 |
It should not be considered as a replacement for professional medical counsel, diagnosis, or therapy for any health or related issues.
|
723 |
Any questions or concerns about your individual health should be addressed to your doctor or another qualified healthcare provider.
|
724 |
-
"""
|
|
|
725 |
|
726 |
clear_button.click(
|
727 |
reset_fn,
|
|
|
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)
|
|
|
457 |
return {
|
458 |
error_box7: gr.update(visible=False),
|
459 |
decrypt_box: out,
|
460 |
+
submit_btn: gr.update(value="Submit"),
|
461 |
}
|
462 |
|
463 |
|
|
|
522 |
</p>
|
523 |
|
524 |
<p align="center">
|
525 |
+
<img width="65%" height="20%" src="https://raw.githubusercontent.com/kcelia/Img/main/healthcare_prediction.jpg">
|
526 |
</p>
|
527 |
"""
|
528 |
)
|
529 |
gr.Markdown("## Notes")
|
530 |
gr.Markdown(
|
531 |
+
"""
|
532 |
- The private key is used to encrypt and decrypt the data and shall never be shared.
|
533 |
- The evaluation key is a public key that the server needs to process encrypted data.
|
534 |
"""
|
|
|
563 |
error_box1 = gr.Textbox(label="Error β", visible=False)
|
564 |
|
565 |
# Default disease, picked from the dataframe
|
566 |
+
gr.Markdown(
|
567 |
+
"You can choose an **existing disease** and explore its associated symptoms.",
|
568 |
+
visible=False,
|
569 |
+
)
|
570 |
|
571 |
with gr.Row():
|
572 |
with gr.Column(scale=2):
|
|
|
578 |
# Submit botton
|
579 |
submit_btn = gr.Button("Submit")
|
580 |
# Clear botton
|
581 |
+
clear_button = gr.Button("Reset Space π", visible=False)
|
|
|
|
|
582 |
|
583 |
+
disease_box.change(
|
584 |
+
fn=display_default_symptoms_fn, inputs=[disease_box], outputs=[default_symptoms]
|
585 |
+
)
|
586 |
|
587 |
submit_btn.click(
|
588 |
fn=get_features_fn,
|
|
|
606 |
gen_key_btn = gr.Button("Generate the evaluation key")
|
607 |
error_box2 = gr.Textbox(label="Error β", visible=False)
|
608 |
user_id_box = gr.Textbox(label="User ID:", visible=True)
|
609 |
+
key_len_box = gr.Textbox(label="Evaluation Key Size:", visible=False)
|
610 |
key_box = gr.Textbox(label="Evaluation key (truncated):", max_lines=3, visible=False)
|
611 |
+
|
612 |
gen_key_btn.click(
|
613 |
key_gen_fn,
|
614 |
inputs=one_hot_vector,
|
|
|
683 |
gr.Markdown("## Step 4: Decrypt the data")
|
684 |
gr.Markdown("<hr />")
|
685 |
gr.Markdown("<span style='color:grey'>Client Side</span>")
|
686 |
+
gr.Markdown(
|
687 |
+
"### Get the encrypted data from the <span style='color:grey'>Server Side</span>"
|
688 |
+
)
|
689 |
|
690 |
error_box6 = gr.Textbox(label="Error β", visible=False)
|
691 |
|
|
|
713 |
inputs=[user_id_box, one_hot_vector, *check_boxes],
|
714 |
outputs=[decrypt_box, error_box7, submit_btn],
|
715 |
)
|
716 |
+
|
717 |
# ------------------------- End -------------------------
|
718 |
+
|
719 |
gr.Markdown(
|
720 |
"""The app was built with [Concrete ML](https://github.com/zama-ai/concrete-ml), a Privacy-Preserving Machine Learning (PPML) open-source set of tools by Zama.
|
721 |
Try it yourself and don't forget to star on [Github](https://github.com/zama-ai/concrete-ml) β.
|
722 |
+
"""
|
723 |
+
)
|
724 |
|
725 |
gr.Markdown("\n\n")
|
726 |
|
727 |
gr.Markdown(
|
728 |
+
"""**Please Note**: This space is intended solely for educational and demonstration purposes.
|
729 |
It should not be considered as a replacement for professional medical counsel, diagnosis, or therapy for any health or related issues.
|
730 |
Any questions or concerns about your individual health should be addressed to your doctor or another qualified healthcare provider.
|
731 |
+
"""
|
732 |
+
)
|
733 |
|
734 |
clear_button.click(
|
735 |
reset_fn,
|
deployment/client.zip
DELETED
Binary file (89.7 kB)
|
|
deployment/server.zip
DELETED
Binary file (1.59 kB)
|
|
deployment/versions.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"concrete-ml": "1.0.3", "concrete-python": "1.0.0", "python": "3.10.6"}
|
|
|
|
deployment_logit_12/client.zip
DELETED
Binary file (2.89 kB)
|
|
deployment_logit_12/server.zip
DELETED
Binary file (5.2 kB)
|
|
deployment_logit_12/versions.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"concrete-ml": "1.0.3", "concrete-python": "1.0.0", "python": "3.10.6"}
|
|
|
|
deployment_logit_13/client.zip
DELETED
Binary file (2.89 kB)
|
|
deployment_logit_13/server.zip
DELETED
Binary file (5.22 kB)
|
|
deployment_logit_13/versions.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"concrete-ml": "1.0.3", "concrete-python": "1.0.0", "python": "3.10.6"}
|
|
|
|
deployment_xgb/client.zip
DELETED
Binary file (88.5 kB)
|
|
deployment_xgb/server.zip
DELETED
Binary file (8.53 kB)
|
|
deployment_xgb/versions.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"concrete-ml": "1.0.3", "concrete-python": "1.0.0", "python": "3.10.6"}
|
|
|
|