Elegbede commited on
Commit
eda6be5
Β·
1 Parent(s): 65b2e69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
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", "fear", "suprise"]
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=[["I Love you."],
28
- ["I hate you"],
29
- ["I am scared"],
30
- ["I am amazed"],
 
 
31
  ],
32
  title="Emotion Classification",
33
- description="Predict the emotion probabilities of a text using a fine-tuned DistilBERT model."
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()