Spaces:
Runtime error
Runtime error
Rob Caamano commited on
App 2.8
Browse files
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 |
-
|
|
|
|
| 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)
|