Rob Caamano commited on
Commit
4bf7fea
·
unverified ·
1 Parent(s): cb4608c
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -31,7 +31,8 @@ def get_highest_toxicity_class(prediction):
31
  return model.config.id2label[max_index], prediction[max_index]
32
 
33
  input = tokenizer(text, return_tensors="tf")
34
- prediction = model(input)[0].numpy()[0]
 
35
 
36
  if st.button("Submit", type="primary"):
37
  label, probability = get_highest_toxicity_class(prediction)
 
31
  return model.config.id2label[max_index], prediction[max_index]
32
 
33
  input = tokenizer(text, return_tensors="tf")
34
+ logits = model(input)[0].numpy()[0]
35
+ prediction = logits / logits.sum()
36
 
37
  if st.button("Submit", type="primary"):
38
  label, probability = get_highest_toxicity_class(prediction)