mskov commited on
Commit
88300e6
·
1 Parent(s): a0682a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -50,7 +50,7 @@ def slider_logic(slider):
50
  return threshold
51
 
52
  # Create a Gradio interface with audio file and text inputs
53
- def classify_toxicity(audio_file, selected_sounds, slider):
54
  # Transcribe the audio file using Whisper ASR
55
  # transcribed_text = pipe(audio_file)["text"]
56
 
@@ -93,7 +93,9 @@ def classify_toxicity(audio_file, selected_sounds, slider):
93
  score = class_score_dict[selected_class_name]
94
  if score > threshold:
95
  print(f"Threshold exceeded for class '{selected_class_name}': Score = {score:.4f}")
96
- show_state : True
 
 
97
 
98
 
99
  '''
@@ -105,7 +107,7 @@ def classify_toxicity(audio_file, selected_sounds, slider):
105
  # miso_label_dict = {label: score for label, score in classify_anxiety[0].items()}
106
  holder2 = ""
107
  holder3= " "
108
- return {class_name: score for class_name, score in zip(class_names, scores)}
109
 
110
  def positive_affirmations():
111
  affirmations = [
@@ -129,7 +131,7 @@ with gr.Blocks() as iface:
129
  # out_val = gr.Textbox()
130
  out_class = gr.Label()
131
  calm_image = gr.Image(value="./hrv-breathing.gif", visible=show_state)
132
- submit_btn.click(fn=classify_toxicity, inputs=[aud_input, miso_sounds, sense_slider], outputs=out_class)
133
 
134
 
135
  iface.launch()
 
50
  return threshold
51
 
52
  # Create a Gradio interface with audio file and text inputs
53
+ def classify_toxicity(audio_file, selected_sounds, viz_state, slider):
54
  # Transcribe the audio file using Whisper ASR
55
  # transcribed_text = pipe(audio_file)["text"]
56
 
 
93
  score = class_score_dict[selected_class_name]
94
  if score > threshold:
95
  print(f"Threshold exceeded for class '{selected_class_name}': Score = {score:.4f}")
96
+ viz_state : True
97
+ else:
98
+ viz_state : False
99
 
100
 
101
  '''
 
107
  # miso_label_dict = {label: score for label, score in classify_anxiety[0].items()}
108
  holder2 = ""
109
  holder3= " "
110
+ return {class_name: score for class_name, score in zip(class_names, scores)}, viz_state
111
 
112
  def positive_affirmations():
113
  affirmations = [
 
131
  # out_val = gr.Textbox()
132
  out_class = gr.Label()
133
  calm_image = gr.Image(value="./hrv-breathing.gif", visible=show_state)
134
+ submit_btn.click(fn=classify_toxicity, inputs=[aud_input, miso_sounds, show_state, sense_slider], outputs=[out_class, calm_image])
135
 
136
 
137
  iface.launch()