taka-yamakoshi commited on
Commit
57c67f2
1 Parent(s): 50a3e5e
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -84,14 +84,14 @@ def annotate_options(sent_id,sent):
84
  option_locs = []
85
  for word_id,(col,word) in enumerate(zip(cols,decoded_sent)):
86
  with col:
87
- if st.button(word,key=f'word_{word_id}'):
88
  if word_id not in option_locs:
89
  option_locs.append(word_id)
90
  else:
91
  option_locs.remove(word_id)
92
  st.markdown(show_annotated_sentence(decoded_sent,option_locs=option_locs,
93
  mask_locs=st.session_state[f'mask_locs_{sent_id}']), unsafe_allow_html = True)
94
- return option_locs
95
 
96
  def show_annotated_sentence(sent,option_locs=[],mask_locs=[]):
97
  disp_style = '"font-family:san serif; color:Black; font-size: 20px"'
@@ -138,6 +138,8 @@ if __name__=='__main__':
138
  st.write('2. Select sites to mask out and click "Confirm"')
139
  annotate_mask(1,sent_1)
140
  annotate_mask(2,sent_2)
 
 
141
  if st.button('Confirm'):
142
  st.session_state['page_status'] = 'annotate_options'
143
  main_area.empty()
 
84
  option_locs = []
85
  for word_id,(col,word) in enumerate(zip(cols,decoded_sent)):
86
  with col:
87
+ if st.button(word,key=f'word_{sent_id}_{word_id}'):
88
  if word_id not in option_locs:
89
  option_locs.append(word_id)
90
  else:
91
  option_locs.remove(word_id)
92
  st.markdown(show_annotated_sentence(decoded_sent,option_locs=option_locs,
93
  mask_locs=st.session_state[f'mask_locs_{sent_id}']), unsafe_allow_html = True)
94
+ st.session_state[f'option_locs_{sent_id}'] = option_locs
95
 
96
  def show_annotated_sentence(sent,option_locs=[],mask_locs=[]):
97
  disp_style = '"font-family:san serif; color:Black; font-size: 20px"'
 
138
  st.write('2. Select sites to mask out and click "Confirm"')
139
  annotate_mask(1,sent_1)
140
  annotate_mask(2,sent_2)
141
+ st.write(st.session_state['mask_locs_1'])
142
+ st.write(st.session_state['mask_locs_2'])
143
  if st.button('Confirm'):
144
  st.session_state['page_status'] = 'annotate_options'
145
  main_area.empty()