Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -686,7 +686,17 @@ def analyze_composite(msg1, msg2, msg3, *answers_and_none):
|
|
686 |
most_common_stage = max(set(stages), key=stages.count)
|
687 |
stage_text = RISK_STAGE_LABELS[most_common_stage]
|
688 |
# Derive top label list for each message
|
689 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
690 |
avg_darvo = round(sum(darvo_scores) / len(darvo_scores), 3)
|
691 |
darvo_blurb = ""
|
692 |
if avg_darvo > 0.25:
|
|
|
686 |
most_common_stage = max(set(stages), key=stages.count)
|
687 |
stage_text = RISK_STAGE_LABELS[most_common_stage]
|
688 |
# Derive top label list for each message
|
689 |
+
# safe derive top_labels
|
690 |
+
top_labels = []
|
691 |
+
for result, _ in results:
|
692 |
+
threshold_labels = result[1]
|
693 |
+
top_patterns = result[2]
|
694 |
+
if threshold_labels:
|
695 |
+
top_labels.append(threshold_labels[0])
|
696 |
+
elif top_patterns:
|
697 |
+
top_labels.append(top_patterns[0][0])
|
698 |
+
else:
|
699 |
+
top_labels.append("none") # or whatever default you prefer
|
700 |
avg_darvo = round(sum(darvo_scores) / len(darvo_scores), 3)
|
701 |
darvo_blurb = ""
|
702 |
if avg_darvo > 0.25:
|