Create diabetes_factors.py
Browse files
components/diabetes_factors.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
def render_factors_info():
|
| 6 |
+
"""
|
| 7 |
+
Creates and returns the Gradio UI for the 'Factors Affecting Diabetes' content.
|
| 8 |
+
"""
|
| 9 |
+
with gr.Blocks() as factors_ui:
|
| 10 |
+
gr.Markdown("## π©Ί Understanding the Factors Behind Diabetes")
|
| 11 |
+
gr.Markdown(
|
| 12 |
+
"Diabetes is a complex condition influenced by a mix of genetic, lifestyle, and environmental factors. "
|
| 13 |
+
"Understanding your personal risk factors is the first step toward prevention and effective management."
|
| 14 |
+
)
|
| 15 |
+
gr.Markdown("---")
|
| 16 |
+
|
| 17 |
+
with gr.Accordion("Type 2 Diabetes: The Most Common Form", open=True):
|
| 18 |
+
gr.Markdown(
|
| 19 |
+
"""
|
| 20 |
+
This occurs when your body becomes resistant to insulin or doesn't produce enough.
|
| 21 |
+
|
| 22 |
+
### Factors You Cannot Change (Non-Modifiable)
|
| 23 |
+
* **𧬠Family History:** A parent or sibling with Type 2 diabetes significantly increases your risk.
|
| 24 |
+
* **ποΈ Age:** Risk increases after age 35.
|
| 25 |
+
* **π Race or Ethnicity:** People of certain backgrounds (African American, Hispanic, American Indian, Asian American) are at higher risk.
|
| 26 |
+
* **π€° History of Gestational Diabetes:** If you had diabetes during a pregnancy, your risk is higher.
|
| 27 |
+
|
| 28 |
+
### Lifestyle-Related Risk Factors (Modifiable)
|
| 29 |
+
* **βοΈ Weight:** Being overweight or having obesity is the single most important risk factor.
|
| 30 |
+
* **πββοΈ Physical Inactivity:** A sedentary lifestyle reduces your body's ability to use insulin.
|
| 31 |
+
* **π Unhealthy Diet:** High consumption of processed foods, sugar, and unhealthy fats.
|
| 32 |
+
* **π©Έ High Blood Pressure & Cholesterol:** These conditions are often linked to insulin resistance.
|
| 33 |
+
* **π¬ Smoking:** This habit increases inflammation and makes it harder for your body to manage blood sugar.
|
| 34 |
+
"""
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
with gr.Accordion("Type 1 Diabetes: An Autoimmune Condition", open=False):
|
| 38 |
+
gr.Markdown(
|
| 39 |
+
"""
|
| 40 |
+
This type occurs when the body's immune system mistakenly attacks and destroys the insulin-producing cells in the pancreas. The exact triggers are not fully known.
|
| 41 |
+
|
| 42 |
+
### Key Factors
|
| 43 |
+
* **𧬠Family History:** While not as strong as in Type 2, having a close relative with Type 1 increases risk.
|
| 44 |
+
* **π¬ Genetics:** Specific genes are known to make individuals more susceptible.
|
| 45 |
+
* **π Age:** It is most commonly diagnosed in children, teens, and young adults.
|
| 46 |
+
* **π¦ Environmental Triggers:** It is believed that certain viruses might trigger the autoimmune attack in genetically predisposed individuals.
|
| 47 |
+
"""
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
with gr.Accordion("Gestational Diabetes: During Pregnancy", open=False):
|
| 51 |
+
gr.Markdown(
|
| 52 |
+
"""
|
| 53 |
+
This type of diabetes develops in some women during pregnancy and usually disappears after birth. However, it increases the risk for both mother and child to develop Type 2 diabetes later in life.
|
| 54 |
+
|
| 55 |
+
### Key Risk Factors
|
| 56 |
+
* **βοΈ Pre-pregnancy Weight:** Being overweight before becoming pregnant.
|
| 57 |
+
* **ποΈ Maternal Age:** Being older than 25.
|
| 58 |
+
* **π¨βπ©βπ§ Family History:** A family history of Type 2 diabetes.
|
| 59 |
+
* **π©Ί Medical History:** Having had gestational diabetes before or having Polycystic Ovary Syndrome (PCOS).
|
| 60 |
+
"""
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
# Note: In a modular setup, you might just build the Markdown/Accordion group
|
| 64 |
+
# and add it to an existing Blocks() instance in app.py.
|
| 65 |
+
# For now, this self-contained block is fine.
|