taka-yamakoshi commited on
Commit
0dc9265
1 Parent(s): c19cc14
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -72,8 +72,7 @@ def annotate_mask(sent_id,sent):
72
  mask_locs.append(word_id)
73
  else:
74
  mask_locs.remove(word_id)
75
- st.markdown(show_annotated_sentence(decoded_sent,mask_locs=mask_locs), unsafe_allow_html = True)
76
- return mask_locs
77
 
78
  def annotate_options(sent_id,sent):
79
  st.write(f'Sentence {sent_id}')
@@ -136,10 +135,16 @@ if __name__=='__main__':
136
  sent_2 = st.session_state['sent_2']
137
 
138
  st.write('2. Select sites to mask out and click "Confirm"')
139
- st.session_state[f'mask_locs_1'] = annotate_mask(1,sent_1)
140
- st.session_state[f'mask_locs_2'] = annotate_mask(2,sent_2)
 
 
 
 
141
  if st.button('Confirm'):
142
  st.session_state['page_status'] = 'annotate_options'
 
 
143
  main_area.empty()
144
 
145
  if st.session_state['page_status'] == 'annotate_options':
 
72
  mask_locs.append(word_id)
73
  else:
74
  mask_locs.remove(word_id)
75
+ return decoded_sent, mask_locs
 
76
 
77
  def annotate_options(sent_id,sent):
78
  st.write(f'Sentence {sent_id}')
 
135
  sent_2 = st.session_state['sent_2']
136
 
137
  st.write('2. Select sites to mask out and click "Confirm"')
138
+ decoded_sent_1, mask_locs_1 = annotate_mask(1,sent_1)
139
+ container_1 = st.container()
140
+ decoded_sent_2, mask_locs_2 = annotate_mask(2,sent_2)
141
+ container_2 = st.container()
142
+ container_1.markdown(show_annotated_sentence(decoded_sent_1,mask_locs=mask_locs_1), unsafe_allow_html = True)
143
+ container_2.markdown(show_annotated_sentence(decoded_sent_2,mask_locs=mask_locs_2), unsafe_allow_html = True)
144
  if st.button('Confirm'):
145
  st.session_state['page_status'] = 'annotate_options'
146
+ st.session_state['mask_locs_1'] = mask_locs_1
147
+ st.session_state['mask_locs_2'] = mask_locs_2
148
  main_area.empty()
149
 
150
  if st.session_state['page_status'] == 'annotate_options':