mskov commited on
Commit
4af9b2b
·
1 Parent(s): 08a9af1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -24
app.py CHANGED
@@ -36,15 +36,15 @@ pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large")
36
  def slider_logic(slider):
37
  threshold = 0
38
  if slider == 1:
39
- threshold = .98
40
- elif slider == 2:
41
  threshold = .88
 
 
42
  elif slider == 3:
43
- threshold = .77
44
  elif slider == 4:
45
- threshold = .66
46
  elif slider == 5:
47
- threshold = .55
48
  else:
49
  threshold = []
50
  return threshold
@@ -96,29 +96,11 @@ def classify_toxicity(audio_file, selected_sounds, slider):
96
  affirm = f"Threshold exceeded for class '{selected_class_name}': Score = {score:.4f}"
97
  else:
98
  affirm = ""
99
-
100
-
101
-
102
- '''
103
- for class_name, score in class_score_dict.items():
104
- if score > threshold:
105
- print(f"Threshold exceeded for class '{class_name}': Score = {score:.4f}")
106
- '''
107
- holder1 = {class_name: score for class_name, score in zip(class_names, scores)}
108
  # miso_label_dict = {label: score for label, score in classify_anxiety[0].items()}
109
 
110
  return {class_name: score for class_name, score in zip(class_names, scores)}, affirm
111
 
112
- def positive_affirmations():
113
- affirmations = [
114
- "I have survived my anxiety before and I will survive again now",
115
- "I am not in danger; I am just uncomfortable; this too will pass",
116
- "I forgive and release the past and look forward to the future",
117
- "I can't control what other people say but I can control my breathing and my response"
118
- ]
119
- selected_affirm = random.choice(affirmations)
120
- return selected_affirm
121
-
122
  with gr.Blocks() as iface:
123
  with gr.Column():
124
  miso_sounds = gr.CheckboxGroup(["chewing", "breathing", "mouthsounds", "popping", "sneezing", "yawning", "smacking", "sniffling", "panting"])
 
36
  def slider_logic(slider):
37
  threshold = 0
38
  if slider == 1:
 
 
39
  threshold = .88
40
+ elif slider == 2:
41
+ threshold = .78
42
  elif slider == 3:
43
+ threshold = .67
44
  elif slider == 4:
45
+ threshold = .56
46
  elif slider == 5:
47
+ threshold = .45
48
  else:
49
  threshold = []
50
  return threshold
 
96
  affirm = f"Threshold exceeded for class '{selected_class_name}': Score = {score:.4f}"
97
  else:
98
  affirm = ""
99
+
 
 
 
 
 
 
 
 
100
  # miso_label_dict = {label: score for label, score in classify_anxiety[0].items()}
101
 
102
  return {class_name: score for class_name, score in zip(class_names, scores)}, affirm
103
 
 
 
 
 
 
 
 
 
 
 
104
  with gr.Blocks() as iface:
105
  with gr.Column():
106
  miso_sounds = gr.CheckboxGroup(["chewing", "breathing", "mouthsounds", "popping", "sneezing", "yawning", "smacking", "sniffling", "panting"])