Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,12 @@ if st.button("Analyze Message"):
|
|
60 |
|
61 |
# Emotion detection
|
62 |
emotion_result = emotion_classifier(user_input)
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
64 |
emotion_score = get_emotion_score(emotion_label)
|
65 |
|
66 |
# Intent detection
|
|
|
60 |
|
61 |
# Emotion detection
|
62 |
emotion_result = emotion_classifier(user_input)
|
63 |
+
if isinstance(emotion_result[0], list): # Handle top_k output format
|
64 |
+
emotion_data = emotion_result[0][0]
|
65 |
+
else:
|
66 |
+
emotion_data = emotion_result[0]
|
67 |
+
|
68 |
+
emotion_label = emotion_data['label']
|
69 |
emotion_score = get_emotion_score(emotion_label)
|
70 |
|
71 |
# Intent detection
|