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

Feat: Instructions page

Browse files
_annotations.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ sample_id,sentence,emotion,confidence,comments
2
+ 007-0023,I was mostly hanging out in East Village in the clubs.,Neutral,50,
3
+ 007-0034,"And we became friends, and then he told me that his lover had died of AIDS.",Angry,0,
4
+ 007-0086,"I mean, given the size of ACT UP, I mean, really, you're talking about a handful.",Neutral,0,
5
+ 007-0129,"And why is he like, you know, why are you putting him in yellow face?",Angry,0,
app.py CHANGED
@@ -6,14 +6,14 @@ import gradio as gr
6
 
7
  css = """#myProgress {
8
  width: 100%;
9
- background-color: gray;
10
  border-radius: 2px;
11
  }
12
 
13
  #myBar {
14
  width: 0%;
15
  height: 30px;
16
- background-color: blue;
17
  border-radius: 2px;
18
  }
19
 
@@ -28,18 +28,47 @@ css = """#myProgress {
28
  top: 50%;
29
  left: 50%;
30
  transform: translate(-50%, -50%);
31
- color: white;
32
- font-weight: bold;
33
- font-size: 14px;
34
  """
 
35
  js_progress_bar = """
36
  function move(n_ann, total_ann) {
37
 
38
  var elem = document.getElementById("myBar");
39
  elem.style.width = n_ann/total_ann * 100 + "%";
40
- progressText.innerText = 'Completed: ' + n_ann + '/' + total_ann
41
  }
42
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  # List of all audio files to annotate
44
  file_list = pd.read_excel(os.path.join('combined_annotations.xlsx'))
45
  total_annotations = len(file_list)
@@ -122,33 +151,6 @@ def activate_elements(emotions, confidence, comments, next_button, previous_butt
122
 
123
 
124
  with (gr.Blocks(theme=gr.themes.Soft(), css = css) as demo):
125
-
126
- ann_completed = gr.Number(1, visible=False)
127
- total = gr.Number(total_annotations, visible=False)
128
-
129
- # Row with progress bar
130
- gr.HTML("""
131
- <div id="myProgress">
132
- <div id="myBar">
133
- <span id="progressText">Press "Let's go!" to start</span>
134
- </div>
135
- </div>""")
136
-
137
- # Row with audio player
138
- with gr.Row():
139
- audio_player = gr.Audio(value= 'test.mp3', label="Audio", type="filepath", interactive=False)
140
-
141
- # Hidden row with corresponding sentence
142
- with gr.Row():
143
- accordion = gr.Accordion(label="Click to see the sentence", open=False)
144
- with accordion:
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)
@@ -156,37 +158,75 @@ with (gr.Blocks(theme=gr.themes.Soft(), css = css) as demo):
156
  #happy_words = gr.Textbox(label = "Happy")
157
 
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(
170
- previous_example,
171
- inputs=[emotions, confidence, comments, participant_id],
172
- outputs=[sentence_text, audio_player, emotions, confidence, ann_completed, comments],
173
- )
174
 
175
- # Go to the next example
176
- next_button.click(
177
- next_example,
178
- inputs=[emotions, confidence, comments, participant_id],
179
- outputs=[sentence_text, audio_player, emotions, confidence, ann_completed, comments],
180
- )
181
- #Update progress bar
182
- next_button.click(None, [], [ann_completed, total], js = js_progress_bar)
183
-
184
-
185
- lets_go.click(None, [], [ann_completed, total], js = js_progress_bar)
186
- lets_go.click(deactivate_participant_id, [participant_id, lets_go], [participant_id, lets_go])
187
- lets_go.click(activate_elements, [emotions, confidence, comments, next_button, previous_button], [emotions, confidence, comments, next_button, previous_button])
188
- lets_go.click(load_example, inputs = [gr.Number(current_index["index"], visible = False)], outputs = [sentence_text, audio_player, emotions, confidence, ann_completed, comments])
189
 
190
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  demo.launch()
192
 
 
6
 
7
  css = """#myProgress {
8
  width: 100%;
9
+ background-color: var(--block-border-color);
10
  border-radius: 2px;
11
  }
12
 
13
  #myBar {
14
  width: 0%;
15
  height: 30px;
16
+ background-color: var(--block-title-background-fill);
17
  border-radius: 2px;
18
  }
19
 
 
28
  top: 50%;
29
  left: 50%;
30
  transform: translate(-50%, -50%);
31
+ color: var(--block-title-text-color);
32
+ font-weight: regular;
33
+ font-size: 14px; }
34
  """
35
+
36
  js_progress_bar = """
37
  function move(n_ann, total_ann) {
38
 
39
  var elem = document.getElementById("myBar");
40
  elem.style.width = n_ann/total_ann * 100 + "%";
41
+ progressText.innerText = 'Completed: ' + n_ann + ' / ' + total_ann
42
  }
43
  """
44
+
45
+ intro = """
46
+ # Emotionality in Speech
47
+ Spoken language communicates more than just words. Speakers use tone, pitch, and other nonverbal cues to express emotions. In emotional speech, these cues can strengthen or even contradict the meaning of the words—for example, irony can make a positive phrase sound sarcastic. For this research, we will focus on three basic emotions plus neutral:
48
+ \n* Anger
49
+ \n* Happiness
50
+ \n* Sadness
51
+ \n* Neutral
52
+ \nThis may seem like a small set, but it's a great starting point for analyzing emotions in such a large collection—303 hours of interviews! (That’s 13 days of nonstop listening!)"""
53
+
54
+ about_act_up = """
55
+ ## What is the archive you will be annotating?
56
+ You will be annotating short audio clips extracted from the ACT UP (AIDS Coalition to Unleash Power) Oral History Project. This archive features interviews with individuals who were part of ACT UP during the late 1980s and early 1990s, amidst the AIDS epidemic.
57
+ In each video, the subjects talk about their life before the epidemic, how they were affected by AIDS and their work in ACT UP.
58
+ """
59
+ about_emotions = """
60
+ ## What will you be annotating?
61
+ You will annotate one emotion per short audio clip, based on the following criteria:
62
+ \n* Predominant Emotion: The emotion expressed with the highest intensity. Emotions can be complex, and multiple emotions may occur at the same time.
63
+ \n* Perceived Emotion at the Time of Recording: In Oral History Archives, interviewees discuss their past. However, you should annotate the emotion they appear to feel at the time of recording, NOT what they felt during the event they describe.
64
+ \n* Speech Emotionality: Focus on how something is said rather than what is said. For example, if a friend recounts an awful day with humor, the content may be sad, but the delivery is joyful. In this case, linguistic emotionality (content) would be classified as sad, while paralinguistic emotionality (tone and delivery) would be classified as joyful.
65
+
66
+ Further, you will be asked to fill "How confident you are that the annotated emotion is present in the recording?" from a scale of 0 to 10, with 0 being "not at all confident" and 1 being "certain, completely confident".
67
+ \nThere will be a "Comment/Feedback" section where you can makes notes.
68
+ \nBelow the audio, there will be an option to view the transcribed sentence. Please use this only if you are struggling to understand the audio.
69
+ \nLet’s explore the four possible categories and listen to some examples!
70
+
71
+ """
72
  # List of all audio files to annotate
73
  file_list = pd.read_excel(os.path.join('combined_annotations.xlsx'))
74
  total_annotations = len(file_list)
 
151
 
152
 
153
  with (gr.Blocks(theme=gr.themes.Soft(), css = css) as demo):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  # Instructions for emotion annotation
155
  with gr.Sidebar():
156
  participant_id = gr.Textbox(label='What is your participant ID?', interactive = True)
 
158
  #happy_words = gr.Textbox(label = "Happy")
159
 
160
 
161
+ with gr.Tab("Instructions"):
162
+ instructions = gr.Markdown(intro)
163
+ about_data = gr.Markdown(about_act_up)
164
+ about_em = gr.Markdown(about_emotions)
165
+
166
+ agreement = gr.Checkbox(value = False, label = "I agree", info = "I agree to have my annotations, comments, and questionnaire answers used for research purposes. I understand that any personal information will be anonymized.", interactive = True)
167
 
 
 
 
 
 
 
 
 
 
 
 
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
+ with gr.Tab("Annotation Interface"):
171
+
172
+ ann_completed = gr.Number(1, visible=False)
173
+ total = gr.Number(total_annotations, visible=False)
174
+
175
+ # Row with progress bar
176
+ gr.HTML("""
177
+ <div id="myProgress">
178
+ <div id="myBar">
179
+ <span id="progressText">Press "Let's go!" to start</span>
180
+ </div>
181
+ </div>""")
182
+
183
+ # Row with audio player
184
+ with gr.Row():
185
+ audio_player = gr.Audio(value= 'test.mp3', label="Audio", type="filepath", interactive=False, show_download_button = False, show_share_button = False)
186
+
187
+ # Hidden row with corresponding sentence
188
+ with gr.Row():
189
+ accordion = gr.Accordion(label="Click to see the sentence", open=False)
190
+ with accordion:
191
+ sentence_text = gr.Textbox(label="Transcription", interactive=False, value = 'This is a sentence.')
192
+ # Row for emotion annotation and confidence
193
+ with gr.Row():
194
+ emotions = gr.Radio(["Blank", "Joy", "Sad", "Angry", "Neutral"], label="Predominant Emotion", value = "Blank", visible = False)
195
+
196
+ with gr.Row():
197
+ confidence = gr.Slider(label="Confidence (%)", minimum=0, maximum=100, step=10, visible = False)
198
+
199
+ with gr.Row():
200
+ # Comment section
201
+ comments = gr.Textbox(label="Comments", visible =False)
202
+
203
+ # Next and Previous Buttons
204
+ with gr.Row():
205
+ previous_button = gr.Button("Previous Example", visible = False)
206
+ next_button = gr.Button("Next Example", visible = False)
207
+
208
+ # Go back
209
+ previous_button.click(
210
+ previous_example,
211
+ inputs=[emotions, confidence, comments, participant_id],
212
+ outputs=[sentence_text, audio_player, emotions, confidence, ann_completed, comments],
213
+ )
214
+
215
+ # Go to the next example
216
+ next_button.click(
217
+ next_example,
218
+ inputs=[emotions, confidence, comments, participant_id],
219
+ outputs=[sentence_text, audio_player, emotions, confidence, ann_completed, comments],
220
+ )
221
+ #Update progress bar
222
+ next_button.click(None, [], [ann_completed, total], js = js_progress_bar)
223
+
224
+
225
+ lets_go.click(None, [], [ann_completed, total], js = js_progress_bar)
226
+ lets_go.click(deactivate_participant_id, [participant_id, lets_go], [participant_id, lets_go])
227
+ lets_go.click(activate_elements, [emotions, confidence, comments, next_button, previous_button], [emotions, confidence, comments, next_button, previous_button])
228
+ lets_go.click(load_example, inputs = [gr.Number(current_index["index"], visible = False)], outputs = [sentence_text, audio_player, emotions, confidence, ann_completed, comments])
229
+
230
+
231
  demo.launch()
232
 
kkk_annotations.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ sample_id,sentence,emotion,confidence,comments
2
+ 007-0023,I was mostly hanging out in East Village in the clubs.,Neutral,0,
3
+ 007-0034,"And we became friends, and then he told me that his lover had died of AIDS.",Neutral,0,
tt_annotations.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ sample_id,sentence,emotion,confidence,comments
2
+ 007-0023,I was mostly hanging out in East Village in the clubs.,Joy,0,
3
+ 007-0034,"And we became friends, and then he told me that his lover had died of AIDS.",Sad,0,
4
+ 007-0086,"I mean, given the size of ACT UP, I mean, really, you're talking about a handful.",Neutral,0,
yguygyguyg_annotations.csv ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ sample_id,sentence,emotion,confidence,comments
2
+ 007-0023,I was mostly hanging out in East Village in the clubs.,Sad,0,huihi
3
+ 007-0034,"And we became friends, and then he told me that his lover had died of AIDS.",Angry,0,
4
+ 007-0086,"I mean, given the size of ACT UP, I mean, really, you're talking about a handful.",Angry,0,
5
+ 007-0129,"And why is he like, you know, why are you putting him in yellow face?",Neutral,0,
6
+ 007-0152,"But what was really amazing was that this was really one of the first grassroots protest movements that was spearheaded by lesbian, gay, Asian, Pacific Islanders.",Neutral,0,
7
+ 007-0165,"We had a couple of people, like, you know, some people come and go.",Neutral,0,
8
+ 007-0174,"And then to be approached by these crazy Asian actors, I think that might be a little much.",Neutral,0,
9
+ 007-0248,"And again, you're talking about this community that's sort of really just starting to come up.",Angry,0,
10
+ 007-0444,"I mean, they're friendly to you. There's a camaraderie, definitely.",Sad,0,
11
+ 008-0016,"My other feminist friends, and we were a little clique.",Sad,0,