Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -480,19 +480,22 @@ def analyze_full_trace(json_input):
|
|
480 |
|
481 |
confidence_result, confidence_data = analyze_confidence_signature(logprobs, tokens)
|
482 |
pivot_result, pivot_data = detect_interpretation_pivots(logprobs, tokens)
|
483 |
-
entropy_result, entropy_data = calculate_decision_entropy(logprobs, tokens)
|
484 |
conclusion_result, conclusion_data = analyze_conclusion_competition(logprobs, tokens)
|
485 |
verification_result, verification_data = analyze_verification_signals(logprobs, tokens)
|
486 |
inversion_result, inversion_data = detect_semantic_inversions(logprobs, tokens)
|
487 |
|
488 |
-
#
|
|
|
|
|
|
|
489 |
analysis_html = f"""
|
490 |
<h3>Trace Analysis Results</h3>
|
491 |
<ul>
|
492 |
<li><strong>Confidence Signature:</strong> {confidence_result}</li>
|
493 |
{f"<ul><li>Details: {', '.join(f'Position: {pos}, Drop: {drop:.4f}, Token: {tok}' for pos, drop, tok in confidence_data)}</li></ul>" if confidence_data else ""}
|
494 |
<li><strong>Interpretation Pivots:</strong> {pivot_result}</li>
|
495 |
-
{f"<ul><li>Details: {
|
496 |
<li><strong>Decision Entropy Spikes:</strong> {entropy_result}</li>
|
497 |
{f"<ul><li>Details: {', '.join(f'Position: {idx}, Entropy: {entropy:.4f}, Token: {tok}' for idx, entropy, tok in entropy_data)}</li></ul>" if entropy_data else ""}
|
498 |
<li><strong>Conclusion Competition:</strong> {conclusion_result}</li>
|
|
|
480 |
|
481 |
confidence_result, confidence_data = analyze_confidence_signature(logprobs, tokens)
|
482 |
pivot_result, pivot_data = detect_interpretation_pivots(logprobs, tokens)
|
483 |
+
entropy_result, entropy_data = calculate_decision_entropy(logprobs, tokens)
|
484 |
conclusion_result, conclusion_data = analyze_conclusion_competition(logprobs, tokens)
|
485 |
verification_result, verification_data = analyze_verification_signals(logprobs, tokens)
|
486 |
inversion_result, inversion_data = detect_semantic_inversions(logprobs, tokens)
|
487 |
|
488 |
+
# Precompute the joined context strings for pivots to avoid backslashes in f-string expressions
|
489 |
+
pivot_details = ', '.join(f"Position: {pos}, Reconsideration: {rt}, Context: {' '.join(context)}" for pos, rt, context in pivot_data) if pivot_data else ""
|
490 |
+
|
491 |
+
# Updated HTML formatting without backslashes in f-string expressions
|
492 |
analysis_html = f"""
|
493 |
<h3>Trace Analysis Results</h3>
|
494 |
<ul>
|
495 |
<li><strong>Confidence Signature:</strong> {confidence_result}</li>
|
496 |
{f"<ul><li>Details: {', '.join(f'Position: {pos}, Drop: {drop:.4f}, Token: {tok}' for pos, drop, tok in confidence_data)}</li></ul>" if confidence_data else ""}
|
497 |
<li><strong>Interpretation Pivots:</strong> {pivot_result}</li>
|
498 |
+
{f"<ul><li>Details: {pivot_details}</li></ul>" if pivot_data else ""}
|
499 |
<li><strong>Decision Entropy Spikes:</strong> {entropy_result}</li>
|
500 |
{f"<ul><li>Details: {', '.join(f'Position: {idx}, Entropy: {entropy:.4f}, Token: {tok}' for idx, entropy, tok in entropy_data)}</li></ul>" if entropy_data else ""}
|
501 |
<li><strong>Conclusion Competition:</strong> {conclusion_result}</li>
|