emvecchi commited on
Commit
5c70c23
·
verified ·
1 Parent(s): c6d9f9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -257,7 +257,7 @@ def get_start_index():
257
  files = hf_fs.ls(output_repo_path + '/' + get_base_path())
258
  return len(files) - 1
259
  else:
260
- return -3
261
 
262
  def read_data():
263
  with hf_fs.open(input_repo_path + '/' + to_annotate_file_name) as f:
@@ -355,8 +355,8 @@ def show_field(f: Field, index: int, data_collected):
355
  if f.name == 'image_name':
356
  display_image(os.path.join(input_repo_path, 'images', value))
357
  elif f.name == 'dialogue_name':
358
- #display_dialogue(os.path.join(input_repo_path, 'dialogues', value))
359
- display_dialogue(os.path.join('diaolgues', value))
360
  else:
361
  st.write(value)
362
  case 'markdown':
@@ -498,7 +498,7 @@ def prep_and_save_data(index, skip_sample):
498
  })
499
 
500
 
501
- # st.set_page_config(layout='wide')
502
  # Title of the app
503
  st.title("Therapy Session Annotation")
504
 
@@ -544,7 +544,7 @@ if 'current_index' not in st.session_state:
544
  st.session_state.current_index = start_index
545
  else:
546
  st.session_state.current_index = start_index+1
547
- st.session_state.form_displayed = -3
548
 
549
  if get_param_from_url('show_extra_fields'):
550
  fields += url_conditional_fields
@@ -565,12 +565,12 @@ def add_checked_submit():
565
  if 'go_to' not in st.session_state:
566
  st.session_state.go_to = 0
567
 
568
- if st.session_state.current_index == -3:
569
  with st.form("data_form"):
570
  st.markdown(consent_text)
571
  add_checked_submit()
572
 
573
- elif st.session_state.current_index == -2:
574
  if st.session_state.get('user_id'):
575
  navigate(1)
576
  else:
@@ -578,11 +578,10 @@ elif st.session_state.current_index == -2:
578
  st.session_state.user_id = st.text_input('User ID', value=user_id_from_url)
579
  add_validated_submit([st.session_state.user_id], "Please enter a valid user ID")
580
 
581
-
582
- elif st.session_state.current_index == -1:
583
- add_annotation_guidelines()
584
- with st.form("intro_form"):
585
- show_fields(intro_fields)
586
 
587
  elif st.session_state.current_index < len(st.session_state.data):
588
  add_annotation_guidelines()
 
257
  files = hf_fs.ls(output_repo_path + '/' + get_base_path())
258
  return len(files) - 1
259
  else:
260
+ return -2
261
 
262
  def read_data():
263
  with hf_fs.open(input_repo_path + '/' + to_annotate_file_name) as f:
 
355
  if f.name == 'image_name':
356
  display_image(os.path.join(input_repo_path, 'images', value))
357
  elif f.name == 'dialogue_name':
358
+ display_dialogue(os.path.join(input_repo_path, 'resolve/main/dialogues', value))
359
+ #display_dialogue(os.path.join('diaolgues', value))
360
  else:
361
  st.write(value)
362
  case 'markdown':
 
498
  })
499
 
500
 
501
+ st.set_page_config(layout='wide')
502
  # Title of the app
503
  st.title("Therapy Session Annotation")
504
 
 
544
  st.session_state.current_index = start_index
545
  else:
546
  st.session_state.current_index = start_index+1
547
+ st.session_state.form_displayed = -2
548
 
549
  if get_param_from_url('show_extra_fields'):
550
  fields += url_conditional_fields
 
565
  if 'go_to' not in st.session_state:
566
  st.session_state.go_to = 0
567
 
568
+ if st.session_state.current_index == -2:
569
  with st.form("data_form"):
570
  st.markdown(consent_text)
571
  add_checked_submit()
572
 
573
+ elif st.session_state.current_index == -1:
574
  if st.session_state.get('user_id'):
575
  navigate(1)
576
  else:
 
578
  st.session_state.user_id = st.text_input('User ID', value=user_id_from_url)
579
  add_validated_submit([st.session_state.user_id], "Please enter a valid user ID")
580
 
581
+ #elif st.session_state.current_index == -1:
582
+ # add_annotation_guidelines()
583
+ # with st.form("intro_form"):
584
+ # show_fields(intro_fields)
 
585
 
586
  elif st.session_state.current_index < len(st.session_state.data):
587
  add_annotation_guidelines()