fpessanha commited on
Commit
0edd040
·
1 Parent(s): 6efb846

Fix: Annotation dataframe handling

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -294,6 +294,10 @@ def load_first_example(participant_id, ann_completed, current_index):
294
  print(len(annotations))
295
  ann_completed = gr.Number(len(annotations) - 1, visible=False)
296
  print(len(annotations))
 
 
 
 
297
  return *load_example(current_index), ann_completed, current_index
298
 
299
  def load_example(index):
@@ -401,9 +405,7 @@ with (gr.Blocks(theme=gr.themes.Soft(), css = css) as demo):
401
  # List of all audio files to annotate
402
 
403
 
404
- # Initialize an empty DataFrame to store annotations
405
- annotations = pd.DataFrame(columns=['sample_id', 'sentence', 'emotion', 'confidence', 'comments', 'n_clicks'])
406
-
407
  # Instructions for emotion annotation
408
  with gr.Sidebar(open = False) as sidebar:
409
  participant_id = gr.Textbox(label='What is your participant ID?', interactive = True)
 
294
  print(len(annotations))
295
  ann_completed = gr.Number(len(annotations) - 1, visible=False)
296
  print(len(annotations))
297
+ else:
298
+ # Initialize an empty DataFrame to store annotations
299
+ annotations = pd.DataFrame(columns=['sample_id', 'sentence', 'emotion', 'confidence', 'comments', 'n_clicks'])
300
+
301
  return *load_example(current_index), ann_completed, current_index
302
 
303
  def load_example(index):
 
405
  # List of all audio files to annotate
406
 
407
 
408
+
 
 
409
  # Instructions for emotion annotation
410
  with gr.Sidebar(open = False) as sidebar:
411
  participant_id = gr.Textbox(label='What is your participant ID?', interactive = True)