taka-yamakoshi commited on
Commit
2b404c9
1 Parent(s): c6dd7aa
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -94,8 +94,9 @@ if __name__=='__main__':
94
  for word_id,(col,word) in enumerate(zip(cols[1:-1],decoded_sent[1:-1])):
95
  with col:
96
  if st.button(word,key=f'word_{word_id}'):
97
- st.session_state['masked_pos_1'].append(word_id)
98
- st.write(f'Masked words: {" ".join([decoded_sent[word_id+1] for word_id in st.session_state["masked_pos_1"])}')
 
99
 
100
  '''
101
  sent_1 = st.sidebar.text_input('Sentence 1',value='It is better to play a prank on Samuel than Craig because he gets angry less often.',on_change=clear_data)
 
94
  for word_id,(col,word) in enumerate(zip(cols[1:-1],decoded_sent[1:-1])):
95
  with col:
96
  if st.button(word,key=f'word_{word_id}'):
97
+ if word_in not in st.session_state['masked_pos_1']:
98
+ st.session_state['masked_pos_1'].append(word_id)
99
+ st.write(f'Masked words: {", ".join([decoded_sent[word_id+1] for word_id in np.sort(st.session_state["masked_pos_1"])])}')
100
 
101
  '''
102
  sent_1 = st.sidebar.text_input('Sentence 1',value='It is better to play a prank on Samuel than Craig because he gets angry less often.',on_change=clear_data)