Update app.py
Browse files
app.py
CHANGED
|
@@ -397,40 +397,46 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 397 |
value="<i>No analysis yet. Upload a document and click Analyze.</i>"
|
| 398 |
)
|
| 399 |
|
| 400 |
-
gr.
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 434 |
|
| 435 |
# Event handlers
|
| 436 |
analyze_btn.click(
|
|
|
|
| 397 |
value="<i>No analysis yet. Upload a document and click Analyze.</i>"
|
| 398 |
)
|
| 399 |
|
| 400 |
+
with gr.Row():
|
| 401 |
+
with gr.Column(scale=1):
|
| 402 |
+
gr.Markdown("### Model Performance")
|
| 403 |
+
gr.HTML(
|
| 404 |
+
f"""
|
| 405 |
+
<div style='padding:12px; border:1px solid #444; border-radius:10px; background:var(--background-fill-primary);'>
|
| 406 |
+
<p style='margin-top:0; margin-bottom:12px;'><b>Trained Model Performance:</b></p>
|
| 407 |
+
|
| 408 |
+
<b>Segmentation Dice:</b>
|
| 409 |
+
<div style='width:100%; background:#333; height:12px; border-radius:6px; margin-bottom:12px;'>
|
| 410 |
+
<div style='width:{MODEL_METRICS['segmentation']['dice']*100:.1f}%; background:#4169E1; height:12px; border-radius:6px;'></div>
|
| 411 |
+
</div>
|
| 412 |
+
|
| 413 |
+
<b>Classification Accuracy:</b>
|
| 414 |
+
<div style='width:100%; background:#333; height:12px; border-radius:6px; margin-bottom:6px;'>
|
| 415 |
+
<div style='width:{MODEL_METRICS['classification']['overall_accuracy']*100:.1f}%; background:#5cb85c; height:12px; border-radius:6px;'></div>
|
| 416 |
+
</div>
|
| 417 |
+
|
| 418 |
+
<small style='opacity:0.8;'>
|
| 419 |
+
Dice: {MODEL_METRICS['segmentation']['dice']*100:.1f}% |
|
| 420 |
+
IoU: {MODEL_METRICS['segmentation']['iou']*100:.1f}% |
|
| 421 |
+
Accuracy: {MODEL_METRICS['classification']['overall_accuracy']*100:.1f}%
|
| 422 |
+
</small>
|
| 423 |
+
</div>
|
| 424 |
+
"""
|
| 425 |
+
)
|
| 426 |
+
|
| 427 |
+
with gr.Column(scale=1):
|
| 428 |
+
gr.Markdown("### Model Architecture")
|
| 429 |
+
gr.Markdown(
|
| 430 |
+
"""
|
| 431 |
+
**Localization:** MobileNetV3-Small + UNet
|
| 432 |
+
- Dice: 62.1% | IoU: 45.1%
|
| 433 |
+
|
| 434 |
+
**Classification:** LightGBM with 526 features
|
| 435 |
+
- Accuracy: 88.97%
|
| 436 |
+
|
| 437 |
+
**Training:** 140K samples from DocTamper dataset
|
| 438 |
+
"""
|
| 439 |
+
)
|
| 440 |
|
| 441 |
# Event handlers
|
| 442 |
analyze_btn.click(
|