Update app.py
Browse files
app.py
CHANGED
|
@@ -228,7 +228,16 @@ desc = "Pipeline: UNet -> mask lungs -> two binary classifiers (Normal vs Bacter
|
|
| 228 |
"If both classifiers fire, the stronger probability is chosen (fallback). Thresholds adjustable."
|
| 229 |
|
| 230 |
|
| 231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
iface = gr.Interface(
|
| 234 |
fn=inference_pipeline,
|
|
@@ -245,27 +254,21 @@ with gr.Blocks() as demo:
|
|
| 245 |
gr.Image(type="pil", label="Masked Image (input × mask)"),
|
| 246 |
gr.Image(type="pil", label="Segmentation Overlay (red mask)")
|
| 247 |
],
|
| 248 |
-
title=title,
|
| 249 |
-
description=desc,
|
| 250 |
allow_flagging="never"
|
| 251 |
)
|
| 252 |
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
samples=example_samples,
|
| 260 |
-
components=[
|
| 261 |
-
# gr.Image(type="filepath")
|
| 262 |
-
gr.Markdown(label="True Label")
|
| 263 |
-
],
|
| 264 |
-
headers=["Images", "Label"],
|
| 265 |
-
label="Test Samples",
|
| 266 |
-
layout="table"
|
| 267 |
-
)
|
| 268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
|
| 270 |
if __name__ == "__main__":
|
| 271 |
demo.launch(share=False)
|
|
|
|
| 228 |
"If both classifiers fire, the stronger probability is chosen (fallback). Thresholds adjustable."
|
| 229 |
|
| 230 |
|
| 231 |
+
example_samples = [
|
| 232 |
+
("images/NORMAL.jpeg", "NORMAL"),
|
| 233 |
+
("images/VIRAL.jpeg", "VIRAL"),
|
| 234 |
+
("images/BACT.jpeg", "BACTERIAL"),
|
| 235 |
+
]
|
| 236 |
+
|
| 237 |
+
with gr.Blocks(title=title) as demo:
|
| 238 |
+
|
| 239 |
+
gr.Markdown(f"### {title}")
|
| 240 |
+
gr.Markdown(desc)
|
| 241 |
|
| 242 |
iface = gr.Interface(
|
| 243 |
fn=inference_pipeline,
|
|
|
|
| 254 |
gr.Image(type="pil", label="Masked Image (input × mask)"),
|
| 255 |
gr.Image(type="pil", label="Segmentation Overlay (red mask)")
|
| 256 |
],
|
|
|
|
|
|
|
| 257 |
allow_flagging="never"
|
| 258 |
)
|
| 259 |
|
| 260 |
+
gr.Markdown("### Test Samples")
|
| 261 |
+
|
| 262 |
+
# Table Header
|
| 263 |
+
with gr.Row():
|
| 264 |
+
gr.Markdown("**Image**")
|
| 265 |
+
gr.Markdown("**Label**")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
|
| 267 |
+
# Table Rows (Images + Labels)
|
| 268 |
+
for img_path, label in example_samples:
|
| 269 |
+
with gr.Row():
|
| 270 |
+
gr.Image(img_path, width=150, show_label=False)
|
| 271 |
+
gr.Markdown(f"<center>{label}</center>")
|
| 272 |
|
| 273 |
if __name__ == "__main__":
|
| 274 |
demo.launch(share=False)
|