Pamudu13 commited on
Commit
0c7787e
·
verified ·
1 Parent(s): d01eb9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -127,7 +127,7 @@ def analyze_emotion(text):
127
 
128
  # Extract emotion scores
129
  if isinstance(emotions, list) and len(emotions) > 0:
130
- emotion_scores = emotions[0]
131
 
132
  # Define emotion categories with their respective thresholds
133
  urgent_emotions = {
@@ -137,7 +137,10 @@ def analyze_emotion(text):
137
  'disapproval': 0.30,
138
  'nervousness': 0.25,
139
  'disgust': 0.20,
140
- 'disappointment': 0.40
 
 
 
141
  }
142
 
143
  high_priority_emotions = {
@@ -146,7 +149,11 @@ def analyze_emotion(text):
146
  'surprise': 0.15,
147
  'curiosity': 0.25,
148
  'optimism': 0.20,
149
- 'pride': 0.10
 
 
 
 
150
  }
151
 
152
  # Calculate weighted urgency scores
 
127
 
128
  # Extract emotion scores
129
  if isinstance(emotions, list) and len(emotions) > 0:
130
+ emotion_scores = [item for item in emotions[0] if item['label'] != 'neutral']
131
 
132
  # Define emotion categories with their respective thresholds
133
  urgent_emotions = {
 
137
  'disapproval': 0.30,
138
  'nervousness': 0.25,
139
  'disgust': 0.20,
140
+ 'disappointment': 0.40,
141
+ 'grief': 0.05, # Added more emotional states
142
+ 'remorse': 0.10,
143
+ 'sadness': 0.40
144
  }
145
 
146
  high_priority_emotions = {
 
149
  'surprise': 0.15,
150
  'curiosity': 0.25,
151
  'optimism': 0.20,
152
+ 'pride': 0.10,
153
+ 'joy': 0.40, # Added more emotional states
154
+ 'love': 0.25,
155
+ 'admiration': 0.25,
156
+ 'gratitude': 0.45
157
  }
158
 
159
  # Calculate weighted urgency scores