Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -85,9 +85,9 @@ def get_emotional_tone_tag(emotions, sentiment, patterns, abuse_score=0):
|
|
85 |
# Main function
|
86 |
def analyze_message(text):
|
87 |
preprocessed = preprocess_sentiment_text(text)
|
88 |
-
|
89 |
-
sentiment_label = "supportive" if
|
90 |
-
sentiment_score = round(
|
91 |
|
92 |
emotions = get_emotion_profile(text)
|
93 |
emotion_summary = "\n".join([f"{k.title()}: {v:.2f}" for k, v in emotions.items()])
|
|
|
85 |
# Main function
|
86 |
def analyze_message(text):
|
87 |
preprocessed = preprocess_sentiment_text(text)
|
88 |
+
sentiment = sst_result[0] # get the first result
|
89 |
+
sentiment_label = "supportive" if sentiment["label"] == "POSITIVE" else "undermining"
|
90 |
+
sentiment_score = round(sentiment["score"] * 100, 2)
|
91 |
|
92 |
emotions = get_emotion_profile(text)
|
93 |
emotion_summary = "\n".join([f"{k.title()}: {v:.2f}" for k, v in emotions.items()])
|