mskov commited on
Commit
465a052
·
1 Parent(s): 031941c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
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
- #score = class_score_dict[selected_class_name]
96
- matching_label_score[class_name] = class_score_dict[class_name]
97
- for label, score in matching_label_score.items():
98
- # Check if the score is greater than the threshold
99
- if score > threshold:
100
- # If it exceeds the threshold, append the label and score to the list
101
- exceeding_threshold.append((label, score))
102
- affirm = "Threshold Exceeded"
103
- else:
104
- affirm = ""
 
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