""" tabs_extra.py ───────────── A lightweight Gradio module that adds a Feature Reference tab and an About tab. Import and attach to your existing Blocks app in projml.py like this: from tabs_extra import add_extra_tabs with gr.Blocks(...) as iface: # ... your existing tabs/content ... add_extra_tabs() iface.launch(...) """ import gradio as gr # ────────────────────────────────────────────── # FEATURE REFERENCE DATA # ────────────────────────────────────────────── FEATURE_INFO = { "aluminium": {"unit": "mg/L", "who_limit": "0.2", "health_risk": "Neurological damage at high doses; suspected link to Alzheimer's disease."}, "ammonia": {"unit": "mg/L", "who_limit": "1.5", "health_risk": "Irritation of the respiratory tract; toxic to aquatic life."}, "arsenic": {"unit": "mg/L", "who_limit": "0.01", "health_risk": "Carcinogenic; causes skin lesions, cancer of bladder, lungs, and skin."}, "barium": {"unit": "mg/L", "who_limit": "0.7", "health_risk": "Increased blood pressure; cardiovascular effects."}, "cadmium": {"unit": "mg/L", "who_limit": "0.003", "health_risk": "Kidney damage; bone disease (itai-itai); carcinogenic."}, "chloramine": {"unit": "mg/L", "who_limit": "4.0", "health_risk": "Irritation of eyes and nose; anaemia in dialysis patients."}, "chromium": {"unit": "mg/L", "who_limit": "0.05", "health_risk": "Hexavalent chromium is carcinogenic; causes liver/kidney damage."}, "copper": {"unit": "mg/L", "who_limit": "2.0", "health_risk": "Nausea, vomiting; liver and kidney damage at high concentrations."}, "flouride": {"unit": "mg/L", "who_limit": "1.5", "health_risk": "Dental/skeletal fluorosis; bone fractures at very high levels."}, "bacteria": {"unit": "CFU/mL","who_limit": "0", "health_risk": "Gastrointestinal illness; cholera, typhoid, dysentery."}, "viruses": {"unit": "PFU/mL","who_limit": "0", "health_risk": "Hepatitis A, polio, gastroenteritis; severe illness."}, "lead": {"unit": "mg/L", "who_limit": "0.01", "health_risk": "Neurotoxic; developmental delays in children; kidney disease."}, "nitrates": {"unit": "mg/L", "who_limit": "10.0", "health_risk": "Methemoglobinaemia (blue baby syndrome) in infants."}, "nitrites": {"unit": "mg/L", "who_limit": "1.0", "health_risk": "Methemoglobinaemia; toxic to infants; potential carcinogen."}, "mercury": {"unit": "mg/L", "who_limit": "0.006", "health_risk": "Neurological damage; Minamata disease; kidney toxicity."}, "perchlorate": {"unit": "mg/L", "who_limit": "0.015", "health_risk": "Disrupts thyroid function; affects metabolism and development."}, "radium": {"unit": "pCi/L", "who_limit": "5.0", "health_risk": "Radioactive; increases cancer risk (bone cancer, leukaemia)."}, "selenium": {"unit": "mg/L", "who_limit": "0.04", "health_risk": "Selenosis (hair/nail loss, nerve damage) at high levels."}, "silver": {"unit": "mg/L", "who_limit": "0.1", "health_risk": "Argyria (permanent blue-grey skin); toxic to aquatic organisms."}, "uranium": {"unit": "mg/L", "who_limit": "0.03", "health_risk": "Kidney toxicity; radioactive; potential carcinogen."}, } def _feature_reference_html(): rows = "" for feature, info in FEATURE_INFO.items(): rows += f"""
All limits follow the WHO Guidelines for Drinking-water Quality (4th Ed.). Values beyond these thresholds are flagged as potential health hazards by the model.
| Parameter | Unit | WHO Limit | Health Risk |
|---|