Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -89,19 +89,21 @@ def classify_toxicity(audio_file, selected_sounds, slider):
|
|
89 |
class_score_dict = {class_name: score for class_name, score in zip(class_names, scores)}
|
90 |
matching_label_score = {}
|
91 |
exceeding_threshold = []
|
|
|
|
|
92 |
for selected_class_name in selected_sounds:
|
93 |
-
print(selected_sounds)
|
94 |
if selected_class_name in class_score_dict:
|
95 |
-
|
96 |
-
matching_label_score[
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
105 |
# miso_label_dict = {label: score for label, score in classify_anxiety[0].items()}
|
106 |
|
107 |
return class_score_dict, affirm
|
|
|
89 |
class_score_dict = {class_name: score for class_name, score in zip(class_names, scores)}
|
90 |
matching_label_score = {}
|
91 |
exceeding_threshold = []
|
92 |
+
|
93 |
+
# Iterate through the selected sounds
|
94 |
for selected_class_name in selected_sounds:
|
|
|
95 |
if selected_class_name in class_score_dict:
|
96 |
+
score = class_score_dict[selected_class_name]
|
97 |
+
matching_label_score[selected_class_name] = score
|
98 |
+
|
99 |
+
# iterate through matching_label_score to check if any scores exceed the threshold
|
100 |
+
for label, score in matching_label_score.items():
|
101 |
+
if score > threshold:
|
102 |
+
exceeding_threshold.append((label, score))
|
103 |
+
affirm = "Threshold Exceeded"
|
104 |
+
else:
|
105 |
+
affirm = ""
|
106 |
+
|
107 |
# miso_label_dict = {label: score for label, score in classify_anxiety[0].items()}
|
108 |
|
109 |
return class_score_dict, affirm
|