emvecchi commited on
Commit
4eb55d8
·
verified ·
1 Parent(s): 39c76a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -30
app.py CHANGED
@@ -44,8 +44,6 @@ output_repo_path = 'datasets/emvecchi/therapy_annotation/pilot'
44
 
45
  to_annotate_file_name = 'to_annotate.csv' # CSV file to annotate
46
 
47
- #STEPS = get_steps()
48
-
49
  INPUT_FIELD_DEFAULT_VALUES = {'slider': 0,
50
  'text': '',
51
  'textarea': '',
@@ -73,12 +71,6 @@ def get_start_index():
73
  except Exception as e:
74
  return -2
75
  return len(files)
76
-
77
- #if hf_fs.exists(output_repo_path + '/' + get_base_path()):
78
- # files = hf_fs.ls(output_repo_path + '/' + get_base_path())
79
- # return len(files) #-1
80
- #else:
81
- # return -2
82
 
83
  def read_data():
84
  with hf_fs.open(input_repo_path + '/' + to_annotate_file_name) as f:
@@ -404,12 +396,6 @@ def show_field(f: Field, index: int, data_collected):
404
  elif key not in st.session_state:
405
  st.session_state[key] = INPUT_FIELD_DEFAULT_VALUES[f.type]
406
 
407
- #default_val = (
408
- # data_collected.get(f.name, INPUT_FIELD_DEFAULT_VALUES[f.type])
409
- # if data_collected else INPUT_FIELD_DEFAULT_VALUES[f.type]
410
- #)
411
- #value = _ensure_key(key, default_val)
412
-
413
  value = st.session_state[key]
414
 
415
  if not SHOW_HELP_ICON:
@@ -434,8 +420,6 @@ def show_field(f: Field, index: int, data_collected):
434
  f.help = None
435
 
436
  value = st.session_state[key]
437
- #value = st.session_state[key] if key in st.session_state else \
438
- # (data_collected[f.name] if data_collected else INPUT_FIELD_DEFAULT_VALUES[f.type])
439
 
440
  match f.type:
441
  case 'checkbox':
@@ -563,14 +547,7 @@ def prep_and_save_data(index, skip_sample, completed: bool):
563
  'skip': skip_sample,
564
  'completed': int(completed),
565
  }
566
- # payload = {
567
- # 'user_id': st.session_state.user_id,
568
- # 'index': st.session_state.current_index,
569
- # **(st.session_state.data.iloc[index][COLS_TO_SAVE].to_dict() if 0 <= index < len(st.session_state.data) else {}),
570
- # **{k: st.session_state[k + str(index)] for k in st.session_state.data_inputs_keys},
571
- # 'skip': skip_sample,
572
- # 'completed': int(completed),
573
- # }
574
  for k in st.session_state.data_inputs_keys:
575
  key = k + str(index)
576
  if key in st.session_state:
@@ -661,12 +638,6 @@ if 'current_index' not in st.session_state:
661
  if 'step' not in st.session_state:
662
  st.session_state.step = 0
663
 
664
- #if get_param_from_url('show_extra_fields'):
665
- # fields1 += url_conditional_fields
666
- #else:
667
- # fields1 += url_conditional_fields
668
-
669
-
670
  def add_validated_submit(fields, message):
671
  st.session_state.form_displayed = st.session_state.current_index
672
  if st.form_submit_button("Submit"):
 
44
 
45
  to_annotate_file_name = 'to_annotate.csv' # CSV file to annotate
46
 
 
 
47
  INPUT_FIELD_DEFAULT_VALUES = {'slider': 0,
48
  'text': '',
49
  'textarea': '',
 
71
  except Exception as e:
72
  return -2
73
  return len(files)
 
 
 
 
 
 
74
 
75
  def read_data():
76
  with hf_fs.open(input_repo_path + '/' + to_annotate_file_name) as f:
 
396
  elif key not in st.session_state:
397
  st.session_state[key] = INPUT_FIELD_DEFAULT_VALUES[f.type]
398
 
 
 
 
 
 
 
399
  value = st.session_state[key]
400
 
401
  if not SHOW_HELP_ICON:
 
420
  f.help = None
421
 
422
  value = st.session_state[key]
 
 
423
 
424
  match f.type:
425
  case 'checkbox':
 
547
  'skip': skip_sample,
548
  'completed': int(completed),
549
  }
550
+
 
 
 
 
 
 
 
551
  for k in st.session_state.data_inputs_keys:
552
  key = k + str(index)
553
  if key in st.session_state:
 
638
  if 'step' not in st.session_state:
639
  st.session_state.step = 0
640
 
 
 
 
 
 
 
641
  def add_validated_submit(fields, message):
642
  st.session_state.form_displayed = st.session_state.current_index
643
  if st.form_submit_button("Submit"):