emvecchi commited on
Commit
d40acd8
·
verified ·
1 Parent(s): 9626def

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -42,11 +42,9 @@ def get_param_from_url(param):
42
 
43
  # 'local' or 'hf'. hf is for Hugging Face file system but has limits on the number of access per hour
44
  filesystem = 'hf'
45
- # path to repo or local file system TODO rename
46
  input_repo_path = 'datasets/emvecchi/therapy_annotation'
47
  output_repo_path = 'datasets/emvecchi/therapy_annotation/pilot'
48
 
49
-
50
  to_annotate_file_name = 'to_annotate.csv' # CSV file to annotate
51
  COLS_TO_SAVE = ['dialogue_id','dialogue_name','generatedPatient']
52
 
@@ -409,14 +407,18 @@ def render_rupture_markers_widget(index: int, choices: list[str]):
409
  b_key = f"rupture_marker_{i}_line_b_{index}"
410
 
411
  with col1:
412
- st.selectbox(
413
- f"Rupture marker {i}",
414
- options=choices,
415
- key=marker_key,
416
- index=(choices.index(st.session_state.get(marker_key))
417
- if st.session_state.get(marker_key) in choices else 0)
418
- if st.session_state.get(marker_key) is not None else 0
419
- )
 
 
 
 
420
  with col2:
421
  if RUPTURE_LINE_INPUT_TYPE == "number":
422
  st.number_input("Lines: from", min_value=0, step=1, key=a_key)
 
42
 
43
  # 'local' or 'hf'. hf is for Hugging Face file system but has limits on the number of access per hour
44
  filesystem = 'hf'
 
45
  input_repo_path = 'datasets/emvecchi/therapy_annotation'
46
  output_repo_path = 'datasets/emvecchi/therapy_annotation/pilot'
47
 
 
48
  to_annotate_file_name = 'to_annotate.csv' # CSV file to annotate
49
  COLS_TO_SAVE = ['dialogue_id','dialogue_name','generatedPatient']
50
 
 
407
  b_key = f"rupture_marker_{i}_line_b_{index}"
408
 
409
  with col1:
410
+ current = st.session_state.get(marker_key, "")
411
+ if marker_key in st.session_state:
412
+ st.selectbox(f"Rupture marker {i}", options=choices, key=marker_key)
413
+ else:
414
+ default_idx = choices.index(current) if current in choices else 0
415
+ st.selectbox(f"Rupture marker {i}", options=choices, key=marker_key, index=default_idx)
416
+ # st.selectbox(
417
+ # f"Rupture marker {i}", options=choices, key=marker_key,
418
+ # index=(choices.index(st.session_state.get(marker_key))
419
+ # if st.session_state.get(marker_key) in choices else 0)
420
+ # if st.session_state.get(marker_key) is not None else 0
421
+ # )
422
  with col2:
423
  if RUPTURE_LINE_INPUT_TYPE == "number":
424
  st.number_input("Lines: from", min_value=0, step=1, key=a_key)