webapp1 commited on
Commit
f814feb
·
verified ·
1 Parent(s): c854e73

Upload fusion_engine.py

Browse files
Files changed (1) hide show
  1. src/models/fusion_engine.py +11 -8
src/models/fusion_engine.py CHANGED
@@ -75,15 +75,15 @@ class LateDecisionFusion:
75
  color_code = "green"
76
  action_summary = "No significant psychological stress detected. Emotional tone is balanced."
77
  elif combined_stress_score < 55.0:
78
- risk_tier = "Mild Stress"
79
  color_code = "blue"
80
  action_summary = f"Mild symptoms of {final_category.lower()} observed. Recommended: short breaks and time-management strategies."
81
  elif combined_stress_score < 80.0:
82
- risk_tier = "Moderate / High Stress"
83
  color_code = "orange"
84
  action_summary = f"Significant signs of {final_category.lower()} and vocal tension detected. Recommended: structured counseling or grounding CBT exercises."
85
  else:
86
- risk_tier = "Severe Emotional Distress / Risk"
87
  color_code = "red"
88
  action_summary = f"High emotional distress and acute {final_category.lower()} detected across both speech and text modalities. Immediate psychological check-in and support advised."
89
 
@@ -108,11 +108,14 @@ class LateDecisionFusion:
108
  if score < 30.0:
109
  tier, color, summary = "Minimal / Normal", "green", "No significant text stress markers identified."
110
  elif score < 55.0:
111
- tier, color, summary = "Mild Stress", "blue", f"Mild linguistic markers of {cat.lower()} identified."
 
112
  elif score < 80.0:
113
- tier, color, summary = "Moderate / High Stress", "orange", f"High frequency of {cat.lower()} vocabulary identified."
 
114
  else:
115
- tier, color, summary = "Severe Emotional Distress / Risk", "red", f"Critical linguistic stress markers for {cat.lower()} detected."
 
116
 
117
  return {
118
  "modality_status": "Single-Modality (Text Only)",
@@ -135,9 +138,9 @@ class LateDecisionFusion:
135
  elif score < 55.0:
136
  tier, color, summary = "Mild Stress", "blue", f"Slight vocal tension ({emotion.lower()}) observed."
137
  elif score < 80.0:
138
- tier, color, summary = "Moderate / High Stress", "orange", f"High vocal agitation ({emotion.lower()}) and spectral energy detected."
139
  else:
140
- tier, color, summary = "Severe Emotional Distress / Risk", "red", f"Severe acoustic stress and emotional agitation ({emotion.lower()}) recorded."
141
 
142
  return {
143
  "modality_status": "Single-Modality (Speech Only)",
 
75
  color_code = "green"
76
  action_summary = "No significant psychological stress detected. Emotional tone is balanced."
77
  elif combined_stress_score < 55.0:
78
+ risk_tier = f"Mild {final_category}" if final_category not in ["Normal", "Stress", "Calm / Normal"] else "Mild Stress"
79
  color_code = "blue"
80
  action_summary = f"Mild symptoms of {final_category.lower()} observed. Recommended: short breaks and time-management strategies."
81
  elif combined_stress_score < 80.0:
82
+ risk_tier = f"Moderate {final_category}" if final_category not in ["Normal", "Stress", "Calm / Normal"] else "Moderate Stress"
83
  color_code = "orange"
84
  action_summary = f"Significant signs of {final_category.lower()} and vocal tension detected. Recommended: structured counseling or grounding CBT exercises."
85
  else:
86
+ risk_tier = f"Severe {final_category}" if final_category not in ["Normal", "Stress", "Calm / Normal"] else "Severe Stress"
87
  color_code = "red"
88
  action_summary = f"High emotional distress and acute {final_category.lower()} detected across both speech and text modalities. Immediate psychological check-in and support advised."
89
 
 
108
  if score < 30.0:
109
  tier, color, summary = "Minimal / Normal", "green", "No significant text stress markers identified."
110
  elif score < 55.0:
111
+ tier = f"Mild {cat}" if cat not in ["Normal", "Stress", "Calm / Normal"] else "Mild Stress"
112
+ color, summary = "blue", f"Mild linguistic markers of {cat.lower()} identified."
113
  elif score < 80.0:
114
+ tier = f"Moderate {cat}" if cat not in ["Normal", "Stress", "Calm / Normal"] else "Moderate Stress"
115
+ color, summary = "orange", f"High frequency of {cat.lower()} vocabulary identified."
116
  else:
117
+ tier = f"Severe {cat}" if cat not in ["Normal", "Stress", "Calm / Normal"] else "Severe Stress"
118
+ color, summary = "red", f"Critical linguistic stress markers for {cat.lower()} detected."
119
 
120
  return {
121
  "modality_status": "Single-Modality (Text Only)",
 
138
  elif score < 55.0:
139
  tier, color, summary = "Mild Stress", "blue", f"Slight vocal tension ({emotion.lower()}) observed."
140
  elif score < 80.0:
141
+ tier, color, summary = "Moderate Stress", "orange", f"High vocal agitation ({emotion.lower()}) and spectral energy detected."
142
  else:
143
+ tier, color, summary = "Severe Stress", "red", f"Severe acoustic stress and emotional agitation ({emotion.lower()}) recorded."
144
 
145
  return {
146
  "modality_status": "Single-Modality (Speech Only)",