scores, not percentages
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ def classify_emotion(text):
|
|
14 |
# Initialize a dictionary with all emotions and a default score of 0
|
15 |
emotion_scores = {emotion: 0.0 for emotion in ALL_EMOTIONS}
|
16 |
|
17 |
-
# Update the dictionary with the scores returned by the model
|
18 |
for item in predictions:
|
19 |
emotion_scores[item["label"]] = item["score"]
|
20 |
|
@@ -28,14 +28,14 @@ gr.Interface(
|
|
28 |
label="Input Text",
|
29 |
lines=4
|
30 |
),
|
31 |
-
outputs=gr.Label(label="Emotion
|
32 |
-
title="CMACHINES |
|
33 |
-
description="This app uses the DistilBERT model fine-tuned for emotion detection. Enter a piece of text to analyze its emotional content!",
|
34 |
examples=[
|
35 |
-
"I like you. I love you.
|
36 |
-
"I am so happy to see you!",
|
37 |
"I'm really angry about what happened.",
|
38 |
"The sunset was absolutely beautiful today.",
|
39 |
-
"I'm worried about the upcoming exam."
|
|
|
40 |
]
|
41 |
).launch()
|
|
|
14 |
# Initialize a dictionary with all emotions and a default score of 0
|
15 |
emotion_scores = {emotion: 0.0 for emotion in ALL_EMOTIONS}
|
16 |
|
17 |
+
# Update the dictionary with the raw scores returned by the model
|
18 |
for item in predictions:
|
19 |
emotion_scores[item["label"]] = item["score"]
|
20 |
|
|
|
28 |
label="Input Text",
|
29 |
lines=4
|
30 |
),
|
31 |
+
outputs=gr.Label(label="Emotion Raw Scores"), # Update label to reflect raw scores
|
32 |
+
title="CMACHINES | motion Detection with DistilBERT (Raw Scores)",
|
33 |
+
description="This app uses the DistilBERT model fine-tuned for emotion detection. Enter a piece of text to analyze its emotional content with raw scores!",
|
34 |
examples=[
|
35 |
+
"I like you. I love you. Sometimes I hate you.",
|
|
|
36 |
"I'm really angry about what happened.",
|
37 |
"The sunset was absolutely beautiful today.",
|
38 |
+
"I'm worried about the upcoming exam.",
|
39 |
+
"Fear is the mind-killer. I will face my fear."
|
40 |
]
|
41 |
).launch()
|