fpessanha commited on
Commit
4f8929d
·
1 Parent(s): d9b07cf

Feat: Hide annotations when participant ID is not visible

Browse files
Files changed (2) hide show
  1. app.py +11 -11
  2. ssddsd_annotations.csv +2 -0
app.py CHANGED
@@ -54,7 +54,6 @@ def load_example(index):
54
 
55
  row = file_list.iloc[index]
56
  audio_path = os.path.join('files_to_annotate_padded_smaller_emotion_set', row["SAMPLE ID"].split('-')[0], row["SAMPLE ID"] + '.wav')
57
- print(f"Audio path: {audio_path}, Exists: {os.path.exists(audio_path)}")
58
  sentence = row["SENTENCE"]
59
 
60
  # If the user already made an annotation for this example, gradio will return said annotation
@@ -109,11 +108,12 @@ def deactivate_participant_id(participant_id, lets_go):
109
  return participant_id, lets_go
110
 
111
  def activate_elements(emotions, confidence, comments, next_button, previous_button):
112
- emotions = gr.Radio(["Blank", "Joy", "Sad", "Angry", "Neutral"], label="Predominant Emotion", value = "Blank", interactive = True)
113
- confidence = gr.Slider(label="Confidence (%)", minimum=0, maximum=100, step=10, interactive = True)
114
- comments = gr.Textbox(label="Comments", interactive=True)
115
- previous_button = gr.Button("Previous Example", interactive = True)
116
- next_button = gr.Button("Next Example", interactive = True)
 
117
 
118
  return emotions, confidence, comments, next_button, previous_button
119
  # ===================
@@ -145,10 +145,10 @@ with (gr.Blocks(theme=gr.themes.Soft(), css = css) as demo):
145
  sentence_text = gr.Textbox(label="Transcription", interactive=False, value = 'This is a sentence.')
146
  # Row for emotion annotation and confidence
147
  with gr.Row():
148
- emotions = gr.Radio(["Blank", "Joy", "Sad", "Angry", "Neutral"], label="Predominant Emotion", value = "Blank", interactive = False)
149
 
150
  with gr.Row():
151
- confidence = gr.Slider(label="Confidence (%)", minimum=0, maximum=100, step=10, interactive = False)
152
  # Instructions for emotion annotation
153
  with gr.Sidebar():
154
  participant_id = gr.Textbox(label='What is your participant ID?', interactive = True)
@@ -158,12 +158,12 @@ with (gr.Blocks(theme=gr.themes.Soft(), css = css) as demo):
158
 
159
  with gr.Row():
160
  # Comment section
161
- comments = gr.Textbox(label="Comments", interactive=False)
162
 
163
  # Next and Previous Buttons
164
  with gr.Row():
165
- previous_button = gr.Button("Previous Example", interactive = False)
166
- next_button = gr.Button("Next Example", interactive = False)
167
 
168
  # Go back
169
  previous_button.click(
 
54
 
55
  row = file_list.iloc[index]
56
  audio_path = os.path.join('files_to_annotate_padded_smaller_emotion_set', row["SAMPLE ID"].split('-')[0], row["SAMPLE ID"] + '.wav')
 
57
  sentence = row["SENTENCE"]
58
 
59
  # If the user already made an annotation for this example, gradio will return said annotation
 
108
  return participant_id, lets_go
109
 
110
  def activate_elements(emotions, confidence, comments, next_button, previous_button):
111
+
112
+ emotions = gr.Radio(["Blank", "Joy", "Sad", "Angry", "Neutral"], label="Predominant Emotion", value = "Blank", visible = True)
113
+ confidence = gr.Slider(label="Confidence (%)", minimum=0, maximum=100, step=10, visible = True)
114
+ comments = gr.Textbox(label="Comments", visible =True)
115
+ previous_button = gr.Button("Previous Example", visible = True)
116
+ next_button = gr.Button("Next Example",visible = True)
117
 
118
  return emotions, confidence, comments, next_button, previous_button
119
  # ===================
 
145
  sentence_text = gr.Textbox(label="Transcription", interactive=False, value = 'This is a sentence.')
146
  # Row for emotion annotation and confidence
147
  with gr.Row():
148
+ emotions = gr.Radio(["Blank", "Joy", "Sad", "Angry", "Neutral"], label="Predominant Emotion", value = "Blank", visible = False)
149
 
150
  with gr.Row():
151
+ confidence = gr.Slider(label="Confidence (%)", minimum=0, maximum=100, step=10, visible = False)
152
  # Instructions for emotion annotation
153
  with gr.Sidebar():
154
  participant_id = gr.Textbox(label='What is your participant ID?', interactive = True)
 
158
 
159
  with gr.Row():
160
  # Comment section
161
+ comments = gr.Textbox(label="Comments", visible =False)
162
 
163
  # Next and Previous Buttons
164
  with gr.Row():
165
+ previous_button = gr.Button("Previous Example", visible = False)
166
+ next_button = gr.Button("Next Example", visible = False)
167
 
168
  # Go back
169
  previous_button.click(
ssddsd_annotations.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ sample_id,sentence,emotion,confidence,comments
2
+ 007-0023,I was mostly hanging out in East Village in the clubs.,Angry,20,sdasdasd