Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,9 +91,9 @@ def predict_chest_slice(input_image):
|
|
| 91 |
]
|
| 92 |
indexed_results.sort(key=lambda x: x["prob"], reverse=True)
|
| 93 |
|
| 94 |
-
# Compile
|
| 95 |
top_winner = indexed_results[0]
|
| 96 |
-
output_summary = f"### Primary Classification:
|
| 97 |
|
| 98 |
# Return Top 3 classes for Gradio's responsive classification list
|
| 99 |
gradio_label_output = {item["label"]: item["prob"] for item in indexed_results[:3]}
|
|
@@ -101,35 +101,14 @@ def predict_chest_slice(input_image):
|
|
| 101 |
return output_summary, gradio_label_output
|
| 102 |
|
| 103 |
# ==============================================================================
|
| 104 |
-
# 3.
|
| 105 |
# ==============================================================================
|
| 106 |
-
saas_theme = gr.themes.Default(
|
| 107 |
-
primary_hue="cyan",
|
| 108 |
-
secondary_hue="slate",
|
| 109 |
-
neutral_hue="slate",
|
| 110 |
-
).set(
|
| 111 |
-
body_background_fill="#030712",
|
| 112 |
-
body_background_fill_dark="#030712",
|
| 113 |
-
block_background_fill="#0f172a",
|
| 114 |
-
block_background_fill_dark="#0f172a",
|
| 115 |
-
block_border_color="#1e293b",
|
| 116 |
-
block_border_width="1px",
|
| 117 |
-
panel_background_fill="#090d16",
|
| 118 |
-
container_radius="16px",
|
| 119 |
-
button_primary_background_fill="#06b6d4",
|
| 120 |
-
button_primary_text_color="#ffffff"
|
| 121 |
-
)
|
| 122 |
-
|
| 123 |
-
# ==============================================================================
|
| 124 |
-
# 4. COMPACT APP SURFACE DESIGN
|
| 125 |
-
# ==============================================================================
|
| 126 |
-
# FIXED: Theme parameter migrated to demo.launch() per Gradio specifications
|
| 127 |
with gr.Blocks(title="Bioset CCCM Engine Deck") as demo:
|
| 128 |
|
| 129 |
# Top Identity Brand Layer
|
| 130 |
gr.Markdown(
|
| 131 |
"""
|
| 132 |
-
#
|
| 133 |
### Part of the **Bioset Model Collection** by **Infinitode** • AI + Biology Initiative
|
| 134 |
---
|
| 135 |
"""
|
|
@@ -138,10 +117,8 @@ with gr.Blocks(title="Bioset CCCM Engine Deck") as demo:
|
|
| 138 |
# Official Bioset Core Clinical Screening and Regulatory Disclaimers
|
| 139 |
gr.Markdown(
|
| 140 |
"""
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
The Chest Cancer Classification Model (CCCM) is a regularized exploratory prototype engineered specifically for research evaluations inside computational biology domains. This architecture does not carry clinical validation certificates, is not cleared by the FDA or equivalent global healthcare oversight entities, and must never be deployed or relied upon as a primary proxy tool for human disease screening or medical case management.
|
| 144 |
-
</div>
|
| 145 |
"""
|
| 146 |
)
|
| 147 |
|
|
@@ -151,7 +128,6 @@ with gr.Blocks(title="Bioset CCCM Engine Deck") as demo:
|
|
| 151 |
with gr.Column(scale=5):
|
| 152 |
gr.Markdown("#### 📥 Tissue Ingestion & Alignment")
|
| 153 |
|
| 154 |
-
# FIXED: Removed 'tool="crop"' since advanced tools are now active by default in Gradio
|
| 155 |
input_image = gr.Image(
|
| 156 |
label="Axial Pulmonary CT Slice Matrix Input",
|
| 157 |
sources=["upload", "clipboard", "webcam"],
|
|
@@ -175,9 +151,7 @@ with gr.Blocks(title="Bioset CCCM Engine Deck") as demo:
|
|
| 175 |
|
| 176 |
gr.Markdown(
|
| 177 |
"""
|
| 178 |
-
|
| 179 |
-
<strong>Pipeline Protocol:</strong> Input slices undergo local adaptive luminance leveling prior to network calculations. This mitigates hardware-specific baseline variance, focusing the model's extraction nodes entirely on tumor texture shapes.
|
| 180 |
-
</div>
|
| 181 |
"""
|
| 182 |
)
|
| 183 |
|
|
@@ -188,37 +162,12 @@ with gr.Blocks(title="Bioset CCCM Engine Deck") as demo:
|
|
| 188 |
### Bioset Model Registry Evaluation Data (CCCM v1.4)
|
| 189 |
The following evaluation benchmarks were captured using an independent test set distribution following shape-equalization optimization:
|
| 190 |
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
</tr>
|
| 198 |
-
</thead>
|
| 199 |
-
<tbody>
|
| 200 |
-
<tr style="border-bottom: 1px solid #1e293b;">
|
| 201 |
-
<td style="padding: 10px 8px; font-weight: bold; color: #10b981;">Optimal Validation Accuracy</td>
|
| 202 |
-
<td style="padding: 10px 8px; font-family: monospace; font-weight: bold; color: #10b981;">93.06%</td>
|
| 203 |
-
<td style="padding: 10px 8px; color: #64748b;">Peak state convergence score</td>
|
| 204 |
-
</tr>
|
| 205 |
-
<tr style="border-bottom: 1px solid #1e293b;">
|
| 206 |
-
<td style="padding: 10px 8px; font-weight: bold;">Validation Loss Baseline</td>
|
| 207 |
-
<td style="padding: 10px 8px; font-family: monospace; color: #f43f5e;">0.1705</td>
|
| 208 |
-
<td style="padding: 10px 8px; color: #64748b;">Cross-Entropy loss ceiling</td>
|
| 209 |
-
</tr>
|
| 210 |
-
<tr style="border-bottom: 1px solid #1e293b;">
|
| 211 |
-
<td style="padding: 10px 8px; font-weight: bold; color: #22d3ee;">Highest Sample Confidence Target</td>
|
| 212 |
-
<td style="padding: 10px 8px; font-family: monospace; font-weight: bold; color: #22d3ee;">98.7%</td>
|
| 213 |
-
<td style="padding: 10px 8px; color: #64748b;">Verified on true positive test splits</td>
|
| 214 |
-
</tr>
|
| 215 |
-
<tr>
|
| 216 |
-
<td style="padding: 10px 8px; font-weight: bold;">Model footprint Volumetrics</td>
|
| 217 |
-
<td style="padding: 10px 8px; font-family: monospace;">16.6 MB</td>
|
| 218 |
-
<td style="padding: 10px 8px; color: #64748b;">Unified monolithic serialization array</td>
|
| 219 |
-
</tr>
|
| 220 |
-
</tbody>
|
| 221 |
-
</table>
|
| 222 |
"""
|
| 223 |
)
|
| 224 |
|
|
@@ -236,5 +185,4 @@ with gr.Blocks(title="Bioset CCCM Engine Deck") as demo:
|
|
| 236 |
)
|
| 237 |
|
| 238 |
if __name__ == "__main__":
|
| 239 |
-
|
| 240 |
-
demo.launch(theme=saas_theme)
|
|
|
|
| 91 |
]
|
| 92 |
indexed_results.sort(key=lambda x: x["prob"], reverse=True)
|
| 93 |
|
| 94 |
+
# Compile summary readout for the UI header
|
| 95 |
top_winner = indexed_results[0]
|
| 96 |
+
output_summary = f"### Primary Classification: **{top_winner['label']}** ({top_winner['prob']*100:.1f}%)"
|
| 97 |
|
| 98 |
# Return Top 3 classes for Gradio's responsive classification list
|
| 99 |
gradio_label_output = {item["label"]: item["prob"] for item in indexed_results[:3]}
|
|
|
|
| 101 |
return output_summary, gradio_label_output
|
| 102 |
|
| 103 |
# ==============================================================================
|
| 104 |
+
# 3. COMPACT APP SURFACE DESIGN
|
| 105 |
# ==============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
with gr.Blocks(title="Bioset CCCM Engine Deck") as demo:
|
| 107 |
|
| 108 |
# Top Identity Brand Layer
|
| 109 |
gr.Markdown(
|
| 110 |
"""
|
| 111 |
+
# Bioset CCCM
|
| 112 |
### Part of the **Bioset Model Collection** by **Infinitode** • AI + Biology Initiative
|
| 113 |
---
|
| 114 |
"""
|
|
|
|
| 117 |
# Official Bioset Core Clinical Screening and Regulatory Disclaimers
|
| 118 |
gr.Markdown(
|
| 119 |
"""
|
| 120 |
+
> ⚠️ **Bioset Model Registry Regulatory Notice**
|
| 121 |
+
> The Chest Cancer Classification Model (CCCM) is a regularized exploratory prototype engineered specifically for research evaluations inside computational biology domains. This architecture does not carry clinical validation certificates, is not cleared by the FDA or equivalent global healthcare oversight entities, and must never be deployed or relied upon as a primary proxy tool for human disease screening or medical case management.
|
|
|
|
|
|
|
| 122 |
"""
|
| 123 |
)
|
| 124 |
|
|
|
|
| 128 |
with gr.Column(scale=5):
|
| 129 |
gr.Markdown("#### 📥 Tissue Ingestion & Alignment")
|
| 130 |
|
|
|
|
| 131 |
input_image = gr.Image(
|
| 132 |
label="Axial Pulmonary CT Slice Matrix Input",
|
| 133 |
sources=["upload", "clipboard", "webcam"],
|
|
|
|
| 151 |
|
| 152 |
gr.Markdown(
|
| 153 |
"""
|
| 154 |
+
* **Pipeline Protocol:** Input slices undergo local adaptive luminance leveling prior to network calculations. This mitigates hardware-specific baseline variance, focusing the model's extraction nodes entirely on tumor texture shapes.
|
|
|
|
|
|
|
| 155 |
"""
|
| 156 |
)
|
| 157 |
|
|
|
|
| 162 |
### Bioset Model Registry Evaluation Data (CCCM v1.4)
|
| 163 |
The following evaluation benchmarks were captured using an independent test set distribution following shape-equalization optimization:
|
| 164 |
|
| 165 |
+
| Target Validation Index | Metric Distribution | Infrastructure Scope |
|
| 166 |
+
| :--- | :--- | :--- |
|
| 167 |
+
| **Optimal Validation Accuracy** | **93.06%** | Peak state convergence score |
|
| 168 |
+
| **Validation Loss Baseline** | **0.1705** | Cross-Entropy loss ceiling |
|
| 169 |
+
| **Highest Sample Confidence Target** | **98.7%** | Verified on true positive test splits |
|
| 170 |
+
| **Model Footprint Volumetrics** | **16.6 MB** | Unified monolithic serialization array |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
"""
|
| 172 |
)
|
| 173 |
|
|
|
|
| 185 |
)
|
| 186 |
|
| 187 |
if __name__ == "__main__":
|
| 188 |
+
demo.launch()
|
|
|