Spaces:
Running
Running
Update SR110 results card design and remove emojis
Browse files- Changed from dark theme to light card design matching MobileNet demo
- Removed all emojis from section headers and error messages
- Applied consistent styling with gradient headers and clean layout
- Maintained 4-card grid structure for performance metrics
π€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- app.py +39 -34
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -106,12 +106,14 @@ def run_vela(model_file):
|
|
| 106 |
]
|
| 107 |
if any(pat in vela_stdout for pat in unsupported_patterns):
|
| 108 |
summary_html = (
|
| 109 |
-
"<div class='sr110-results' style='background:#
|
| 110 |
-
"
|
| 111 |
-
"
|
| 112 |
-
"This model has unsupported layers and needs investigation based on layers.<br>"
|
| 113 |
-
"Please use Vela compiler on your Host Machine for further analysis."
|
| 114 |
"</div>"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
)
|
| 116 |
# Try to provide per-layer.csv if available for download
|
| 117 |
per_layer_csv = None
|
|
@@ -139,34 +141,33 @@ def run_vela(model_file):
|
|
| 139 |
return val.lstrip("= ").strip() if isinstance(val, str) else val
|
| 140 |
|
| 141 |
summary_html = (
|
| 142 |
-
"<div class='sr110-results' style='background:#
|
| 143 |
-
"
|
| 144 |
-
"<
|
| 145 |
-
"
|
|
|
|
|
|
|
| 146 |
# Card 1: Accelerator
|
| 147 |
-
"<div class='
|
| 148 |
-
"<div class='
|
| 149 |
-
f"<div
|
| 150 |
-
f"<div><span class='sr110-label' style='color:#ccc;'>Accelerator clock:</span> <span class='sr110-value' style='color:#fff;font-weight:500'>{summary_dict.get('Accelerator clock','-')}</span></div>"
|
| 151 |
"</div>"
|
| 152 |
# Card 2: Memory Usage
|
| 153 |
-
"<div class='
|
| 154 |
-
"<div class='
|
| 155 |
-
f"<div
|
| 156 |
-
f"<div><span class='sr110-label' style='color:#ccc;'>Total On-chip Flash:</span> <span class='sr110-value' style='color:#fff;font-weight:500'>{summary_dict.get('Total On-chip Flash used','-')}</span></div>"
|
| 157 |
"</div>"
|
| 158 |
# Card 3: Operator Distribution
|
| 159 |
-
"<div class='
|
| 160 |
-
"<div class='
|
| 161 |
-
f"<div
|
| 162 |
-
f"<div><span class='sr110-label' style='color:#ccc;'>NPU Operators:</span> <span class='sr110-value' style='color:#fff;font-weight:500'>{clean_ops(summary_dict.get('NPU operators','-'))}</span></div>"
|
| 163 |
"</div>"
|
| 164 |
# Card 4: Performance
|
| 165 |
-
"<div class='
|
| 166 |
-
"<div class='
|
| 167 |
-
f"<div
|
| 168 |
"</div>"
|
| 169 |
-
"</div></div>"
|
| 170 |
) if summary_items else "<div style='color:red'>Summary info not found in log.</div>"
|
| 171 |
|
| 172 |
for fname in os.listdir(output_dir):
|
|
@@ -354,11 +355,13 @@ def compile_uploaded_model(model_file):
|
|
| 354 |
"""Compile uploaded model with Vela and return results"""
|
| 355 |
if model_file is None:
|
| 356 |
error_html = (
|
| 357 |
-
"<div class='sr110-results' style='background:#
|
| 358 |
-
"
|
| 359 |
-
"
|
| 360 |
-
"No model file uploaded."
|
| 361 |
"</div>"
|
|
|
|
|
|
|
|
|
|
| 362 |
)
|
| 363 |
return (
|
| 364 |
error_html,
|
|
@@ -377,11 +380,13 @@ def compile_uploaded_model(model_file):
|
|
| 377 |
)
|
| 378 |
except Exception as e:
|
| 379 |
error_html = (
|
| 380 |
-
"<div class='sr110-results' style='background:#
|
| 381 |
-
"
|
| 382 |
-
"
|
| 383 |
-
f"Vela compilation failed: {str(e)}"
|
| 384 |
"</div>"
|
|
|
|
|
|
|
|
|
|
| 385 |
)
|
| 386 |
return (
|
| 387 |
error_html,
|
|
@@ -622,7 +627,7 @@ with gr.Blocks(
|
|
| 622 |
|
| 623 |
gr.HTML("""
|
| 624 |
<div class="main-header">
|
| 625 |
-
<h1
|
| 626 |
</div>
|
| 627 |
""")
|
| 628 |
|
|
|
|
| 106 |
]
|
| 107 |
if any(pat in vela_stdout for pat in unsupported_patterns):
|
| 108 |
summary_html = (
|
| 109 |
+
"<div class='sr110-results card' style='background:#fafafa;border-radius:12px;box-shadow:0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -1px rgba(0,0,0,0.06);border:1px solid #e5e7eb;margin-bottom:1.5rem;max-width:500px;width:100%;margin:auto;overflow:hidden;'>"
|
| 110 |
+
"<div class='card-header' style='background:linear-gradient(135deg,#dc2626 0%,#b91c1c 100%);color:white;padding:1rem 1.5rem;border-radius:12px 12px 0 0;font-weight:600;font-size:1.1rem;'>"
|
| 111 |
+
"<span style='color:white;font-weight:600;'>Unsupported Model</span>"
|
|
|
|
|
|
|
| 112 |
"</div>"
|
| 113 |
+
"<div class='card-content' style='padding:1.5rem;color:#4b5563;line-height:1.6;background:#fafafa;text-align:center;'>"
|
| 114 |
+
"This model has unsupported layers and needs investigation based on layers.<br><br>"
|
| 115 |
+
"Please use Vela compiler on your Host Machine for further analysis."
|
| 116 |
+
"</div></div>"
|
| 117 |
)
|
| 118 |
# Try to provide per-layer.csv if available for download
|
| 119 |
per_layer_csv = None
|
|
|
|
| 141 |
return val.lstrip("= ").strip() if isinstance(val, str) else val
|
| 142 |
|
| 143 |
summary_html = (
|
| 144 |
+
"<div class='sr110-results card' style='background:#fafafa;border-radius:12px;box-shadow:0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -1px rgba(0,0,0,0.06);border:1px solid #e5e7eb;margin-bottom:1.5rem;max-width:500px;width:100%;margin:auto;overflow:hidden;'>"
|
| 145 |
+
"<div class='card-header' style='background:linear-gradient(135deg,#1975cf 0%,#1557b0 100%);color:white;padding:1rem 1.5rem;border-radius:12px 12px 0 0;font-weight:600;font-size:1.1rem;'>"
|
| 146 |
+
"<span style='color:white;font-weight:600;'>Estimated Results on SR110</span>"
|
| 147 |
+
"</div>"
|
| 148 |
+
"<div class='card-content' style='padding:1.5rem;color:#4b5563;line-height:1.6;background:#fafafa;'>"
|
| 149 |
+
"<div style='display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;'>"
|
| 150 |
# Card 1: Accelerator
|
| 151 |
+
"<div class='stat-item' style='background:#f8fafc;padding:1rem;border-radius:8px;border-left:4px solid #1975cf;'>"
|
| 152 |
+
"<div class='stat-label' style='font-weight:600;color:#1975cf;font-size:0.9rem;margin-bottom:0.5rem;'>Accelerator</div>"
|
| 153 |
+
f"<div class='stat-value' style='color:#4b5563;font-size:0.85rem;'><strong>Configuration:</strong> {summary_dict.get('Accelerator configuration','-')}<br><strong>Clock:</strong> {summary_dict.get('Accelerator clock','-')}</div>"
|
|
|
|
| 154 |
"</div>"
|
| 155 |
# Card 2: Memory Usage
|
| 156 |
+
"<div class='stat-item' style='background:#f8fafc;padding:1rem;border-radius:8px;border-left:4px solid #1975cf;'>"
|
| 157 |
+
"<div class='stat-label' style='font-weight:600;color:#1975cf;font-size:0.9rem;margin-bottom:0.5rem;'>Memory Usage</div>"
|
| 158 |
+
f"<div class='stat-value' style='color:#4b5563;font-size:0.85rem;'><strong>Total SRAM:</strong> {summary_dict.get('Total SRAM used','-')}<br><strong>Total Flash:</strong> {summary_dict.get('Total On-chip Flash used','-')}</div>"
|
|
|
|
| 159 |
"</div>"
|
| 160 |
# Card 3: Operator Distribution
|
| 161 |
+
"<div class='stat-item' style='background:#f8fafc;padding:1rem;border-radius:8px;border-left:4px solid #1975cf;'>"
|
| 162 |
+
"<div class='stat-label' style='font-weight:600;color:#1975cf;font-size:0.9rem;margin-bottom:0.5rem;'>Operator Distribution</div>"
|
| 163 |
+
f"<div class='stat-value' style='color:#4b5563;font-size:0.85rem;'><strong>CPU Operators:</strong> {clean_ops(summary_dict.get('CPU operators','-'))}<br><strong>NPU Operators:</strong> {clean_ops(summary_dict.get('NPU operators','-'))}</div>"
|
|
|
|
| 164 |
"</div>"
|
| 165 |
# Card 4: Performance
|
| 166 |
+
"<div class='stat-item' style='background:#f8fafc;padding:1rem;border-radius:8px;border-left:4px solid #1975cf;'>"
|
| 167 |
+
"<div class='stat-label' style='font-weight:600;color:#1975cf;font-size:0.9rem;margin-bottom:0.5rem;'>Performance</div>"
|
| 168 |
+
f"<div class='stat-value' style='color:#4b5563;font-size:0.85rem;'><strong>Inference time:</strong> {summary_dict.get('Inference time','-')}</div>"
|
| 169 |
"</div>"
|
| 170 |
+
"</div></div></div>"
|
| 171 |
) if summary_items else "<div style='color:red'>Summary info not found in log.</div>"
|
| 172 |
|
| 173 |
for fname in os.listdir(output_dir):
|
|
|
|
| 355 |
"""Compile uploaded model with Vela and return results"""
|
| 356 |
if model_file is None:
|
| 357 |
error_html = (
|
| 358 |
+
"<div class='sr110-results card' style='background:#fafafa;border-radius:12px;box-shadow:0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -1px rgba(0,0,0,0.06);border:1px solid #e5e7eb;margin-bottom:1.5rem;max-width:500px;width:100%;margin:auto;overflow:hidden;'>"
|
| 359 |
+
"<div class='card-header' style='background:linear-gradient(135deg,#dc2626 0%,#b91c1c 100%);color:white;padding:1rem 1.5rem;border-radius:12px 12px 0 0;font-weight:600;font-size:1.1rem;'>"
|
| 360 |
+
"<span style='color:white;font-weight:600;'>No Model</span>"
|
|
|
|
| 361 |
"</div>"
|
| 362 |
+
"<div class='card-content' style='padding:1.5rem;color:#4b5563;line-height:1.6;background:#fafafa;text-align:center;'>"
|
| 363 |
+
"No model file uploaded."
|
| 364 |
+
"</div></div>"
|
| 365 |
)
|
| 366 |
return (
|
| 367 |
error_html,
|
|
|
|
| 380 |
)
|
| 381 |
except Exception as e:
|
| 382 |
error_html = (
|
| 383 |
+
"<div class='sr110-results card' style='background:#fafafa;border-radius:12px;box-shadow:0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -1px rgba(0,0,0,0.06);border:1px solid #e5e7eb;margin-bottom:1.5rem;max-width:500px;width:100%;margin:auto;overflow:hidden;'>"
|
| 384 |
+
"<div class='card-header' style='background:linear-gradient(135deg,#dc2626 0%,#b91c1c 100%);color:white;padding:1rem 1.5rem;border-radius:12px 12px 0 0;font-weight:600;font-size:1.1rem;'>"
|
| 385 |
+
"<span style='color:white;font-weight:600;'>Compilation Failed</span>"
|
|
|
|
| 386 |
"</div>"
|
| 387 |
+
"<div class='card-content' style='padding:1.5rem;color:#4b5563;line-height:1.6;background:#fafafa;text-align:center;'>"
|
| 388 |
+
f"Vela compilation failed: {str(e)}"
|
| 389 |
+
"</div></div>"
|
| 390 |
)
|
| 391 |
return (
|
| 392 |
error_html,
|
|
|
|
| 627 |
|
| 628 |
gr.HTML("""
|
| 629 |
<div class="main-header">
|
| 630 |
+
<h1>DSCNN Wake Word Detection</h1>
|
| 631 |
</div>
|
| 632 |
""")
|
| 633 |
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
tensorflow>=2.10.0
|
| 2 |
-
gradio
|
| 3 |
librosa>=0.10.0
|
| 4 |
soundfile>=0.12.0
|
| 5 |
numpy>=1.21.0
|
|
|
|
| 1 |
tensorflow>=2.10.0
|
| 2 |
+
gradio==4.44.0
|
| 3 |
librosa>=0.10.0
|
| 4 |
soundfile>=0.12.0
|
| 5 |
numpy>=1.21.0
|