sbenel commited on
Commit
bdce97a
1 Parent(s): de93d77

add show emotions name

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -14,7 +14,8 @@ def translate(text):
14
  logits = output.logits
15
  prediction = F.softmax(logits, dim=1)
16
  y_pred = torch.argmax(prediction).numpy()
17
- return y_pred
 
18
  # output = model.generate(input["input_ids"], max_length=40, num_beams=4, early_stopping=True)
19
 
20
  title = "Text Emotion Classification"
 
14
  logits = output.logits
15
  prediction = F.softmax(logits, dim=1)
16
  y_pred = torch.argmax(prediction).numpy()
17
+ class_names = ['sad','joy','love','anger','fear','surprise']
18
+ return class_names[y_pred]
19
  # output = model.generate(input["input_ids"], max_length=40, num_beams=4, early_stopping=True)
20
 
21
  title = "Text Emotion Classification"