Spaces:
Runtime error
Runtime error
Rob Caamano
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,7 +26,7 @@ if selected_model in ["Fine-tuned Toxicity Model"]:
|
|
| 26 |
toxicity_classes = ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"]
|
| 27 |
model.config.id2label = {i: toxicity_classes[i] for i in range(model.config.num_labels)}
|
| 28 |
|
| 29 |
-
def get_toxicity_class(predictions, threshold=0.
|
| 30 |
return {model.config.id2label[i]: pred for i, pred in enumerate(predictions) if pred >= threshold}
|
| 31 |
|
| 32 |
input = tokenizer(text, return_tensors="tf")
|
|
|
|
| 26 |
toxicity_classes = ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"]
|
| 27 |
model.config.id2label = {i: toxicity_classes[i] for i in range(model.config.num_labels)}
|
| 28 |
|
| 29 |
+
def get_toxicity_class(predictions, threshold=0.3):
|
| 30 |
return {model.config.id2label[i]: pred for i, pred in enumerate(predictions) if pred >= threshold}
|
| 31 |
|
| 32 |
input = tokenizer(text, return_tensors="tf")
|