Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1314,94 +1314,38 @@ def build_ui():
|
|
| 1314 |
font-size: 12.5px;
|
| 1315 |
line-height: 1.35;
|
| 1316 |
}}
|
| 1317 |
-
|
| 1318 |
-
margin-top:
|
| 1319 |
-
|
| 1320 |
-
|
| 1321 |
-
background: rgba(255,255,255,0.03);
|
| 1322 |
-
border: 1px solid rgba(255,255,255,0.08);
|
| 1323 |
}}
|
| 1324 |
-
|
| 1325 |
-
.muted {{ opacity: 0.85; font-size: 12.5px; line-height: 1.35; margin-top: 6px; }}
|
| 1326 |
-
ul, ol {{ margin: 8px 0 0 18px; }}
|
| 1327 |
-
li {{ margin: 4px 0; }}
|
| 1328 |
-
.footer {{ margin-top: 10px; opacity: 0.70; font-size: 12px; }}
|
| 1329 |
</style>
|
| 1330 |
|
| 1331 |
<div class="wrap">
|
| 1332 |
-
|
| 1333 |
<div class="hero">
|
| 1334 |
<h2>TB X-ray screening assistant (research / decision support)</h2>
|
| 1335 |
-
<p>
|
| 1336 |
-
Upload chest X-rays to get an AI screening score, heatmaps, and a simple consensus output.
|
| 1337 |
-
Designed to be safer on imperfect inputs (phone photos / WhatsApp / screenshots).
|
| 1338 |
-
</p>
|
| 1339 |
|
| 1340 |
<div class="chips">
|
| 1341 |
<span class="chip"><b>{MODEL_NAME_TBNET}</b> + Grad-CAM</span>
|
| 1342 |
<span class="chip">Auto Lung Mask + fail-safe</span>
|
| 1343 |
-
<span class="chip"><b>{MODEL_NAME_RADIO}</b> RAW
|
| 1344 |
<span class="chip">Consensus: ✅ LOW · ⚠️ INDET · ⚠️ SCREEN+ · 🚩 TB+</span>
|
|
|
|
| 1345 |
</div>
|
|
|
|
|
|
|
| 1346 |
</div>
|
| 1347 |
|
| 1348 |
<div class="warn">
|
| 1349 |
<b>Clinical disclaimer:</b> Not diagnostic. TB can be subtle (incl. miliary TB).
|
| 1350 |
-
If TB is clinically suspected, pursue
|
| 1351 |
-
<b>regardless of AI output</b>.
|
| 1352 |
</div>
|
| 1353 |
|
| 1354 |
-
<details>
|
| 1355 |
-
<summary>Phone / WhatsApp Mode — when should I use it?</summary>
|
| 1356 |
-
<div class="muted">
|
| 1357 |
-
Use this for <b>WhatsApp-forwarded</b> images, <b>phone photos</b> of films/screens, or <b>screenshots</b> with borders.
|
| 1358 |
-
It applies:
|
| 1359 |
-
<ul>
|
| 1360 |
-
<li><b>Safe border crop</b> (only when borders are detected)</li>
|
| 1361 |
-
<li><b>Conditional CLAHE</b> (only when underexposed / low detail)</li>
|
| 1362 |
-
<li><b>Quality warnings</b> (blur, over/underexposure, heavy borders)</li>
|
| 1363 |
-
</ul>
|
| 1364 |
-
<div class="muted"><b>Tip:</b> Keep it <b>OFF</b> for clean digital exports.</div>
|
| 1365 |
-
</div>
|
| 1366 |
-
</details>
|
| 1367 |
-
|
| 1368 |
-
<details>
|
| 1369 |
-
<summary>Explainability & safety checks</summary>
|
| 1370 |
-
<div class="muted">
|
| 1371 |
-
<ul>
|
| 1372 |
-
<li><b>Grad-CAM</b> highlights regions influencing TBNet.</li>
|
| 1373 |
-
<li><b>RADIO heatmaps</b> show model attention (RAW and sometimes MASKED).</li>
|
| 1374 |
-
<li><b>Fail-safe:</b> if lung masking looks unreliable, scoring is disabled → indeterminate.</li>
|
| 1375 |
-
<li><b>Quality score</b> warns when reliability may be reduced.</li>
|
| 1376 |
-
</ul>
|
| 1377 |
-
</div>
|
| 1378 |
-
</details>
|
| 1379 |
-
|
| 1380 |
-
<details>
|
| 1381 |
-
<summary>How to use</summary>
|
| 1382 |
-
<div class="muted">
|
| 1383 |
-
<ol>
|
| 1384 |
-
<li>Click <b>Continue</b> to open the interface.</li>
|
| 1385 |
-
<li>Upload one or more X-ray images.</li>
|
| 1386 |
-
<li>Enable <b>Phone/WhatsApp Mode</b> if your images are phone/WhatsApp/screenshot.</li>
|
| 1387 |
-
<li>(Optional) Enable <b>{MODEL_NAME_RADIO}</b> for a second model + heatmaps.</li>
|
| 1388 |
-
<li>Click <b>Run Analysis</b>.</li>
|
| 1389 |
-
</ol>
|
| 1390 |
-
</div>
|
| 1391 |
-
</details>
|
| 1392 |
-
|
| 1393 |
-
<details>
|
| 1394 |
-
<summary>Privacy / processing (HF Spaces)</summary>
|
| 1395 |
-
<div class="muted">
|
| 1396 |
-
Images are processed by the Space runtime. Avoid uploading personally identifiable medical data.
|
| 1397 |
-
Prefer anonymized images when possible.
|
| 1398 |
-
</div>
|
| 1399 |
-
</details>
|
| 1400 |
-
|
| 1401 |
<div class="footer">
|
| 1402 |
-
Device
|
| 1403 |
</div>
|
| 1404 |
-
|
| 1405 |
</div>
|
| 1406 |
"""
|
| 1407 |
)
|
|
|
|
| 1314 |
font-size: 12.5px;
|
| 1315 |
line-height: 1.35;
|
| 1316 |
}}
|
| 1317 |
+
.tip {{
|
| 1318 |
+
margin-top: 10px;
|
| 1319 |
+
opacity: 0.85;
|
| 1320 |
+
font-size: 12.5px;
|
|
|
|
|
|
|
| 1321 |
}}
|
| 1322 |
+
.footer {{ margin-top: 10px; opacity: 0.65; font-size: 12px; }}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1323 |
</style>
|
| 1324 |
|
| 1325 |
<div class="wrap">
|
|
|
|
| 1326 |
<div class="hero">
|
| 1327 |
<h2>TB X-ray screening assistant (research / decision support)</h2>
|
| 1328 |
+
<p>Upload chest X-rays to get an AI screening score, heatmaps, and a simple consensus output.</p>
|
|
|
|
|
|
|
|
|
|
| 1329 |
|
| 1330 |
<div class="chips">
|
| 1331 |
<span class="chip"><b>{MODEL_NAME_TBNET}</b> + Grad-CAM</span>
|
| 1332 |
<span class="chip">Auto Lung Mask + fail-safe</span>
|
| 1333 |
+
<span class="chip"><b>{MODEL_NAME_RADIO}</b> RAW/MASKED</span>
|
| 1334 |
<span class="chip">Consensus: ✅ LOW · ⚠️ INDET · ⚠️ SCREEN+ · 🚩 TB+</span>
|
| 1335 |
+
<span class="chip">Phone/WhatsApp Mode (safe preprocessing)</span>
|
| 1336 |
</div>
|
| 1337 |
+
|
| 1338 |
+
<div class="tip"><b>Tip:</b> Enable Phone/WhatsApp Mode for phone photos, WhatsApp-forwarded images, or screenshots with borders.</div>
|
| 1339 |
</div>
|
| 1340 |
|
| 1341 |
<div class="warn">
|
| 1342 |
<b>Clinical disclaimer:</b> Not diagnostic. TB can be subtle (incl. miliary TB).
|
| 1343 |
+
If TB is clinically suspected, pursue CBNAAT/GeneXpert/sputum and/or CT chest regardless of AI output.
|
|
|
|
| 1344 |
</div>
|
| 1345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1346 |
<div class="footer">
|
| 1347 |
+
Device: <b>{DEVICE}</b> (FORCE_CPU={FORCE_CPU})
|
| 1348 |
</div>
|
|
|
|
| 1349 |
</div>
|
| 1350 |
"""
|
| 1351 |
)
|