non2013 commited on
Commit
6b53e40
·
1 Parent(s): 1084a38

added Decode

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -103,7 +103,8 @@ class DeBERTaV3Model:
103
  label = "Insincere" if (F.softmax(preds[0], dim=1)[:, 1]>0.4878) else "Sincere"
104
  probs = {
105
  "Probability": float(F.softmax(preds[0], dim=1)[:, 1]),
106
- "Sequence": test_tensor[test_tensor != 0]
 
107
  }
108
  return label, probs
109
 
@@ -130,7 +131,8 @@ class BiLSTMModel:
130
  probs = {
131
  "Probability": float(avg_pred),
132
  "Model Probabilities": {"Model 1": float(pred1), "Model 2": float(pred2), "Model 3": float(pred3), "Model 4": float(pred4)},
133
- "Sequence": seq
 
134
  }
135
  return label, probs
136
 
 
103
  label = "Insincere" if (F.softmax(preds[0], dim=1)[:, 1]>0.4878) else "Sincere"
104
  probs = {
105
  "Probability": float(F.softmax(preds[0], dim=1)[:, 1]),
106
+ "Sequence": test_tensor[test_tensor != 0],
107
+ "Decoded Sequence": tokenizer.decode(test_tensor[test_tensor != 0], skip_special_tokens=True)
108
  }
109
  return label, probs
110
 
 
131
  probs = {
132
  "Probability": float(avg_pred),
133
  "Model Probabilities": {"Model 1": float(pred1), "Model 2": float(pred2), "Model 3": float(pred3), "Model 4": float(pred4)},
134
+ "Sequence": seq,
135
+ "Decoded Sequence": " ".join([list(word_dict.keys())[list(word_dict.values()).index(i)] for i in seq])
136
  }
137
  return label, probs
138