Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ def predict(texts):
|
|
15 |
new_labels_pred = tf.argmax(new_predictions.logits, axis=1)
|
16 |
new_labels_pred = new_labels_pred.numpy()[0]
|
17 |
|
18 |
-
labels_list = ["Sadness", "Joy", "Love", "Anger", "
|
19 |
emotion = labels_list[new_labels_pred]
|
20 |
return emotion
|
21 |
|
@@ -24,13 +24,15 @@ iface = gr.Interface(
|
|
24 |
fn=predict,
|
25 |
inputs="text",
|
26 |
outputs=gr.outputs.Label(num_top_classes = 6), # Corrected output type
|
27 |
-
examples=[["
|
28 |
-
["
|
29 |
-
["
|
30 |
-
["
|
|
|
|
|
31 |
],
|
32 |
title="Emotion Classification",
|
33 |
-
description="Predict the emotion
|
34 |
)
|
35 |
# Launch the interfac
|
36 |
iface.launch()
|
|
|
15 |
new_labels_pred = tf.argmax(new_predictions.logits, axis=1)
|
16 |
new_labels_pred = new_labels_pred.numpy()[0]
|
17 |
|
18 |
+
labels_list = ["Sadness π", "Joy π", "Love π", "Anger π ", "Fear π¨", "Surprise π²"]
|
19 |
emotion = labels_list[new_labels_pred]
|
20 |
return emotion
|
21 |
|
|
|
24 |
fn=predict,
|
25 |
inputs="text",
|
26 |
outputs=gr.outputs.Label(num_top_classes = 6), # Corrected output type
|
27 |
+
examples=[["Tears welled up in her eyes as she gazed at the old family photo."],
|
28 |
+
["Laughter filled the room as they reminisced about their adventures."],
|
29 |
+
["A handwritten note awaited her on the kitchen table, a reminder of his affection."],
|
30 |
+
["Harsh words were exchanged in the heated argument."],
|
31 |
+
["The eerie silence of the abandoned building sent shivers down her spine."],
|
32 |
+
["The unexpected twist in the story left readers in disbelief."]
|
33 |
],
|
34 |
title="Emotion Classification",
|
35 |
+
description="Predict the emotion associated with a text using my fine-tuned DistilBERT model."
|
36 |
)
|
37 |
# Launch the interfac
|
38 |
iface.launch()
|