Spaces:
Runtime error
Runtime error
Oliver Li
commited on
Commit
·
58e1783
1
Parent(s):
809559e
removed unused code
Browse files
app.py
CHANGED
@@ -54,12 +54,7 @@ if st.button("Analyze"):
|
|
54 |
outputs = toxicity_detector(text, top_k=2)
|
55 |
|
56 |
category_names = ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"]
|
57 |
-
scores = [output["score"] for output in outputs[0]]
|
58 |
|
59 |
-
# Get the highest toxicity class and its probability
|
60 |
-
max_score_index = scores.index(max(scores))
|
61 |
-
highest_toxicity_class = category_names[max_score_index]
|
62 |
-
highest_probability = scores[max_score_index]
|
63 |
|
64 |
results = []
|
65 |
for item in outputs:
|
|
|
54 |
outputs = toxicity_detector(text, top_k=2)
|
55 |
|
56 |
category_names = ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"]
|
|
|
57 |
|
|
|
|
|
|
|
|
|
58 |
|
59 |
results = []
|
60 |
for item in outputs:
|