Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -483,18 +483,22 @@ with tabs[0]:
|
|
483 |
# Format details
|
484 |
details = ""
|
485 |
if show_details:
|
|
|
|
|
|
|
486 |
details = f"""
|
487 |
3-Class Probability: {result['prob3class']:.2f}
|
488 |
3-Class Predicted Label: {['NEI', 'SUPPORTED', 'REFUTED'][result['pred_tc']]}
|
489 |
2-Class Probability: {result['prob2class']:.2f}
|
490 |
2-Class Predicted Label: {['SUPPORTED', 'REFUTED'][result['pred_bc']] if isinstance(result['pred_bc'], int) and result['pred_tc'] != 0 else 'Not used'}
|
491 |
-
|
492 |
Performance Metrics:
|
493 |
-
- GPU Memory Used: {
|
494 |
-
- GPU Memory Cached: {
|
495 |
- CPU Usage: {final_perf['cpu_percent']}%
|
496 |
- Memory Usage: {final_perf['memory_percent']}%
|
497 |
"""
|
|
|
498 |
|
499 |
# Store result with performance metrics
|
500 |
st.session_state.latest_result = {
|
@@ -524,6 +528,12 @@ with tabs[0]:
|
|
524 |
"NEI": "verdict-nei"
|
525 |
}.get(res['verdict'], "")
|
526 |
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
st.markdown(f"""
|
528 |
<div class="result-box">
|
529 |
<h3>Verification Results</h3>
|
@@ -540,7 +550,7 @@ with tabs[0]:
|
|
540 |
<ul>
|
541 |
<li>CPU: {res['performance_metrics']['cpu_percent']}%</li>
|
542 |
<li>RAM: {res['performance_metrics']['memory_percent']}%</li>
|
543 |
-
{
|
544 |
</ul>
|
545 |
</div>
|
546 |
{f"<div class='code-block'><pre>{res['details']}</pre></div>" if show_details else ""}
|
@@ -557,7 +567,7 @@ Details: {res['details']}
|
|
557 |
Performance:
|
558 |
- CPU: {res['performance_metrics']['cpu_percent']}%
|
559 |
- RAM: {res['performance_metrics']['memory_percent']}%
|
560 |
-
|
561 |
"""
|
562 |
st.download_button(
|
563 |
"📥 Download Results",
|
|
|
483 |
# Format details
|
484 |
details = ""
|
485 |
if show_details:
|
486 |
+
gpu_memory_used = f"{float(final_perf.get('gpu_memory_used', 0)):.2f} MB" if DEVICE == "cuda" else "N/A"
|
487 |
+
gpu_memory_cached = f"{float(final_perf.get('gpu_memory_cached', 0)):.2f} MB" if DEVICE == "cuda" else "N/A"
|
488 |
+
|
489 |
details = f"""
|
490 |
3-Class Probability: {result['prob3class']:.2f}
|
491 |
3-Class Predicted Label: {['NEI', 'SUPPORTED', 'REFUTED'][result['pred_tc']]}
|
492 |
2-Class Probability: {result['prob2class']:.2f}
|
493 |
2-Class Predicted Label: {['SUPPORTED', 'REFUTED'][result['pred_bc']] if isinstance(result['pred_bc'], int) and result['pred_tc'] != 0 else 'Not used'}
|
494 |
+
|
495 |
Performance Metrics:
|
496 |
+
- GPU Memory Used: {gpu_memory_used}
|
497 |
+
- GPU Memory Cached: {gpu_memory_cached}
|
498 |
- CPU Usage: {final_perf['cpu_percent']}%
|
499 |
- Memory Usage: {final_perf['memory_percent']}%
|
500 |
"""
|
501 |
+
|
502 |
|
503 |
# Store result with performance metrics
|
504 |
st.session_state.latest_result = {
|
|
|
528 |
"NEI": "verdict-nei"
|
529 |
}.get(res['verdict'], "")
|
530 |
|
531 |
+
gpu_memory_text = (
|
532 |
+
f"<li>GPU Memory: {float(res['performance_metrics'].get('gpu_memory_used', 0)):.2f} MB</li>"
|
533 |
+
if DEVICE == "cuda"
|
534 |
+
else "<li>GPU Memory: N/A</li>"
|
535 |
+
)
|
536 |
+
|
537 |
st.markdown(f"""
|
538 |
<div class="result-box">
|
539 |
<h3>Verification Results</h3>
|
|
|
550 |
<ul>
|
551 |
<li>CPU: {res['performance_metrics']['cpu_percent']}%</li>
|
552 |
<li>RAM: {res['performance_metrics']['memory_percent']}%</li>
|
553 |
+
{gpu_memory_text}
|
554 |
</ul>
|
555 |
</div>
|
556 |
{f"<div class='code-block'><pre>{res['details']}</pre></div>" if show_details else ""}
|
|
|
567 |
Performance:
|
568 |
- CPU: {res['performance_metrics']['cpu_percent']}%
|
569 |
- RAM: {res['performance_metrics']['memory_percent']}%
|
570 |
+
- GPU Memory: {f"{float(res['performance_metrics'].get('gpu_memory_used', 0)):.2f} MB" if DEVICE == "cuda" else "N/A"}
|
571 |
"""
|
572 |
st.download_button(
|
573 |
"📥 Download Results",
|