Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,7 +53,17 @@ FEATURES = [
|
|
| 53 |
NUMERIC_INPUTS = {"age", "BMI", "Previos_Obsteric_History_AB"}
|
| 54 |
BOOL_FEATURES = [f for f in FEATURES if f not in NUMERIC_INPUTS] # flags
|
| 55 |
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
def normalize(s: str) -> str:
|
| 58 |
return re.sub(r"[^a-z0-9]+", "", str(s).lower())
|
| 59 |
|
|
@@ -276,15 +286,18 @@ hr.sep { border: none; border-top: 1px solid #e5e7eb; margin: 8px 0 14px; }
|
|
| 276 |
# -------- Left: Manual inputs + Sample picker --------
|
| 277 |
with gr.Column(scale=1):
|
| 278 |
gr.Markdown("### 1) Manual input")
|
| 279 |
-
age_in = gr.Number(label="
|
| 280 |
-
bmi_in = gr.Number(label="BMI", value=None, precision=3)
|
| 281 |
-
prev_ab = gr.Number(label="
|
|
|
|
| 282 |
|
| 283 |
gr.Markdown("<hr class='sep'/>")
|
| 284 |
gr.Markdown("#### Clinical flags")
|
| 285 |
checkbox_map: Dict[str, gr.Checkbox] = {}
|
| 286 |
-
for feat in
|
| 287 |
-
checkbox_map[feat] = gr.Checkbox(label=
|
|
|
|
|
|
|
| 288 |
|
| 289 |
gr.Markdown("<hr class='sep'/>")
|
| 290 |
thr = gr.Slider(0.05, 0.95, value=0.50, step=0.01, label=f"Decision threshold for class '{POS_CLASS}'")
|
|
|
|
| 53 |
NUMERIC_INPUTS = {"age", "BMI", "Previos_Obsteric_History_AB"}
|
| 54 |
BOOL_FEATURES = [f for f in FEATURES if f not in NUMERIC_INPUTS] # flags
|
| 55 |
|
| 56 |
+
FLAG_SPECS = [
|
| 57 |
+
("history_of_htn", "History of hypertension β Yes / No"),
|
| 58 |
+
("family_history_dm", "Family history of diabetes mellitus β Yes / No"),
|
| 59 |
+
("family_history_htn", "Family history of hypertension β Yes / No"),
|
| 60 |
+
("history_infectious_cardiovascular_diseae", "History of cardiovascular diseases β Yes / No"),
|
| 61 |
+
("history_infectious_endocrine_metabolic_disease", "History of endocrine metabolic disease β Yes / No"),
|
| 62 |
+
("history_infectious_digestive_disease", "History of digestive disease β Yes / No"),
|
| 63 |
+
("Current_history_obsteric", "Current obstetric normal β Yes / No"),
|
| 64 |
+
("infertility", "History of infertility β Yes / No"),
|
| 65 |
+
]
|
| 66 |
+
-------- Utilities ----------
|
| 67 |
def normalize(s: str) -> str:
|
| 68 |
return re.sub(r"[^a-z0-9]+", "", str(s).lower())
|
| 69 |
|
|
|
|
| 286 |
# -------- Left: Manual inputs + Sample picker --------
|
| 287 |
with gr.Column(scale=1):
|
| 288 |
gr.Markdown("### 1) Manual input")
|
| 289 |
+
age_in = gr.Number(label="Age β 19β48 years", value=None, precision=2)
|
| 290 |
+
bmi_in = gr.Number(label="BMI β 16β169 kg/mΒ²", value=None, precision=3)
|
| 291 |
+
prev_ab = gr.Number(label="History of abortion in previous pregnancies β count (0β6)", value=None, precision=0)
|
| 292 |
+
|
| 293 |
|
| 294 |
gr.Markdown("<hr class='sep'/>")
|
| 295 |
gr.Markdown("#### Clinical flags")
|
| 296 |
checkbox_map: Dict[str, gr.Checkbox] = {}
|
| 297 |
+
for feat, nice_label in FLAG_SPECS:
|
| 298 |
+
checkbox_map[feat] = gr.Checkbox(label=nice_label, value=False)
|
| 299 |
+
|
| 300 |
+
|
| 301 |
|
| 302 |
gr.Markdown("<hr class='sep'/>")
|
| 303 |
thr = gr.Slider(0.05, 0.95, value=0.50, step=0.01, label=f"Decision threshold for class '{POS_CLASS}'")
|