Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -141,14 +141,14 @@ def predict_hate_speech(audio_path):
|
|
141 |
predicted_class = torch.argmax(probabilities, dim=1).item()
|
142 |
confidence = probabilities[0][predicted_class].item()
|
143 |
|
144 |
-
if confidence > 65 and predicted_class == 1:
|
145 |
result = {
|
146 |
'Classification': 'Hate Speech\n',
|
147 |
'Confidence': f"{confidence:.2%}"
|
148 |
}
|
149 |
else:
|
150 |
-
if confidence <
|
151 |
-
confidence =
|
152 |
result = {
|
153 |
'Classification': 'Non-Hate Speech\n',
|
154 |
'Confidence': f"{confidence:.2%}"
|
|
|
141 |
predicted_class = torch.argmax(probabilities, dim=1).item()
|
142 |
confidence = probabilities[0][predicted_class].item()
|
143 |
|
144 |
+
if confidence > 0.65 and predicted_class == 1:
|
145 |
result = {
|
146 |
'Classification': 'Hate Speech\n',
|
147 |
'Confidence': f"{confidence:.2%}"
|
148 |
}
|
149 |
else:
|
150 |
+
if confidence < 0.5 and predicted_class == 1:
|
151 |
+
confidence = 1 - confidence
|
152 |
result = {
|
153 |
'Classification': 'Non-Hate Speech\n',
|
154 |
'Confidence': f"{confidence:.2%}"
|