chore: add link to LR
Browse files- README.md +1 -1
- app.py +12 -14
- symptoms_categories.py +4 -4
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title: Health Prediction On
|
3 |
emoji: 🩺😷
|
4 |
colorFrom: gray
|
5 |
colorTo: blue
|
|
|
1 |
---
|
2 |
+
title: Health Prediction On Encrypted Data Using Fully Homomorphic Encryption
|
3 |
emoji: 🩺😷
|
4 |
colorFrom: gray
|
5 |
colorTo: blue
|
app.py
CHANGED
@@ -437,16 +437,14 @@ def decrypt_fn(
|
|
437 |
|
438 |
out = ""
|
439 |
|
440 |
-
if (
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
out = "⚠️ The prediction appears uncertain; including more symptoms may improve the results."
|
446 |
|
447 |
out = (
|
448 |
-
f"{out}
|
449 |
-
"Given the symptoms you provided: "
|
450 |
f"{pretty_print(checked_symptoms, case_conversion=str.capitalize, delimiter=', ')}\n\n"
|
451 |
"Here are the top3 predictions:\n\n"
|
452 |
f"1. « {get_disease_name(top3_diseases[0])} » with a probability of {top3_proba[0]:.2%}\n"
|
@@ -529,9 +527,9 @@ if __name__ == "__main__":
|
|
529 |
gr.Markdown("## Notes")
|
530 |
gr.Markdown(
|
531 |
"""
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
)
|
536 |
|
537 |
# ------------------------- Step 1 -------------------------
|
@@ -666,7 +664,7 @@ if __name__ == "__main__":
|
|
666 |
gr.Markdown("<span style='color:grey'>Server Side</span>")
|
667 |
gr.Markdown(
|
668 |
"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"
|
669 |
-
"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)."
|
670 |
)
|
671 |
|
672 |
run_fhe_btn = gr.Button("Run the FHE evaluation")
|
@@ -719,7 +717,7 @@ if __name__ == "__main__":
|
|
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")
|
@@ -728,7 +726,7 @@ if __name__ == "__main__":
|
|
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(
|
|
|
437 |
|
438 |
out = ""
|
439 |
|
440 |
+
if top3_proba[0] < threshold or abs(top3_proba[0] - top3_proba[1]) < 0.1:
|
441 |
+
out = (
|
442 |
+
"⚠️ The prediction appears uncertain; including more symptoms "
|
443 |
+
"may improve the results.\n\n"
|
444 |
+
)
|
|
|
445 |
|
446 |
out = (
|
447 |
+
f"{out}Given the symptoms you provided: "
|
|
|
448 |
f"{pretty_print(checked_symptoms, case_conversion=str.capitalize, delimiter=', ')}\n\n"
|
449 |
"Here are the top3 predictions:\n\n"
|
450 |
f"1. « {get_disease_name(top3_diseases[0])} » with a probability of {top3_proba[0]:.2%}\n"
|
|
|
527 |
gr.Markdown("## Notes")
|
528 |
gr.Markdown(
|
529 |
"""
|
530 |
+
- The private key is used to encrypt and decrypt the data and shall never be shared.
|
531 |
+
- The evaluation key is a public key that the server needs to process encrypted data.
|
532 |
+
"""
|
533 |
)
|
534 |
|
535 |
# ------------------------- Step 1 -------------------------
|
|
|
664 |
gr.Markdown("<span style='color:grey'>Server Side</span>")
|
665 |
gr.Markdown(
|
666 |
"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"
|
667 |
+
"This server employs a [Logistic Regression](https://github.com/zama-ai/concrete-ml/tree/release/1.1.x/use_case_examples/disease_prediction) model that has been trained on this [data-set](https://github.com/anujdutt9/Disease-Prediction-from-Symptoms/tree/master/dataset)."
|
668 |
)
|
669 |
|
670 |
run_fhe_btn = gr.Button("Run the FHE evaluation")
|
|
|
717 |
gr.Markdown(
|
718 |
"""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.
|
719 |
Try it yourself and don't forget to star on [Github](https://github.com/zama-ai/concrete-ml) ⭐.
|
720 |
+
"""
|
721 |
)
|
722 |
|
723 |
gr.Markdown("\n\n")
|
|
|
726 |
"""**Please Note**: This space is intended solely for educational and demonstration purposes.
|
727 |
It should not be considered as a replacement for professional medical counsel, diagnosis, or therapy for any health or related issues.
|
728 |
Any questions or concerns about your individual health should be addressed to your doctor or another qualified healthcare provider.
|
729 |
+
"""
|
730 |
)
|
731 |
|
732 |
clear_button.click(
|
symptoms_categories.py
CHANGED
@@ -84,8 +84,8 @@ THORAX_SYMPTOMS = {
|
|
84 |
]
|
85 |
}
|
86 |
|
87 |
-
|
88 |
-
"
|
89 |
"sunken_eyes",
|
90 |
"redness_of_eyes",
|
91 |
"watering_from_eyes",
|
@@ -96,7 +96,7 @@ EYES_SYMPTOMS = {
|
|
96 |
}
|
97 |
|
98 |
VASCULAR_LYMPHATIC_SYMPTOMS = {
|
99 |
-
"
|
100 |
"cold_hands_and_feets",
|
101 |
"swollen_blood_vessels",
|
102 |
"swollen_legs",
|
@@ -191,7 +191,7 @@ SYMPTOMS_LIST = [
|
|
191 |
DERMATOLOGICAL_SYMPTOMS,
|
192 |
MUSCULOSKELETAL_SYMPTOMS,
|
193 |
# Column 3
|
194 |
-
|
195 |
THORAX_SYMPTOMS,
|
196 |
GENERAL_SYMPTOMS,
|
197 |
]
|
|
|
84 |
]
|
85 |
}
|
86 |
|
87 |
+
OPHTHALMOLOGICAL_SYMPTOMS = {
|
88 |
+
"OPHTHALMOLOGICAL_CONCERNS": [
|
89 |
"sunken_eyes",
|
90 |
"redness_of_eyes",
|
91 |
"watering_from_eyes",
|
|
|
96 |
}
|
97 |
|
98 |
VASCULAR_LYMPHATIC_SYMPTOMS = {
|
99 |
+
"VASCULAR_AND_LYMPHATIC_CONCERNS": [
|
100 |
"cold_hands_and_feets",
|
101 |
"swollen_blood_vessels",
|
102 |
"swollen_legs",
|
|
|
191 |
DERMATOLOGICAL_SYMPTOMS,
|
192 |
MUSCULOSKELETAL_SYMPTOMS,
|
193 |
# Column 3
|
194 |
+
OPHTHALMOLOGICAL_SYMPTOMS,
|
195 |
THORAX_SYMPTOMS,
|
196 |
GENERAL_SYMPTOMS,
|
197 |
]
|