anonymousauthors commited on
Commit
3e701f9
β€’
1 Parent(s): 75d0a70

Upload 3 files

Browse files
SecretLanguage.py CHANGED
@@ -20,12 +20,18 @@ st.markdown('This webpage serves as an illustration of an anonymous submission t
20
  st.markdown('### How to play with this page?')
21
  st.markdown('We present two methods for searching secret language: a direct search using the Dictionary (Search) option, and browsing words that have already been found for secret languages.')
22
 
23
- st.markdown("By entering a word you want to find its secret languages, you can view the word's meaning in English, all the secret languages we have discovered for it, and examples.")
 
24
  st.image(search_image, caption='A search example.')
25
 
26
  st.markdown('By clicking on the initial letters (A to Z, numbers, and other characters), you can view all the words whose secret languages have been discovered and that begin with the selected initial. By clicking on a word, you will be redirected to the search page, where you can view information about the selected word.')
27
  st.image(browse_image, caption='A browse example.')
28
 
 
 
 
 
 
29
  st.markdown('### Ethics statements for this webpage')
30
 
31
  st.markdown('We present secret languages discovered using our proposed algorithms. '
 
20
  st.markdown('### How to play with this page?')
21
  st.markdown('We present two methods for searching secret language: a direct search using the Dictionary (Search) option, and browsing words that have already been found for secret languages.')
22
 
23
+ st.markdown("By entering a word you want to find its secret languages, you can view the word's meaning in English, all the secret languages we have discovered for it, and examples."
24
+ "The hyperlinks sometimes might not work due to the contained property of Hugging Face space.")
25
  st.image(search_image, caption='A search example.')
26
 
27
  st.markdown('By clicking on the initial letters (A to Z, numbers, and other characters), you can view all the words whose secret languages have been discovered and that begin with the selected initial. By clicking on a word, you will be redirected to the search page, where you can view information about the selected word.')
28
  st.image(browse_image, caption='A browse example.')
29
 
30
+ st.markdown('### Models and datasets.')
31
+
32
+ st.markdown('On this page, we present the secret languages we discovered using ALBERT, DistillBERT, and Roberta models and data from the GLUE (MRPC), SNLI, and SQuAD datasets.')
33
+
34
+
35
  st.markdown('### Ethics statements for this webpage')
36
 
37
  st.markdown('We present secret languages discovered using our proposed algorithms. '
pages/0_πŸ“™_Dictionary_(Search).py CHANGED
@@ -106,15 +106,17 @@ if title in datas:
106
  present_sl_task(secret_language_by_task, 'QA')
107
  present_sl_task(secret_language_by_task, 'Paraphrase')
108
 
109
- st.markdown(f"*Hyperlinks only function when the corresponding tab is open. "
110
- f"For example, the hyperlinks in the paraphrase section will only work when the paraphrase tab is open. However, due to the container property of Huggingface Space, the hyperlinks might be not able to function.*")
 
111
  st.markdown(f"---")
112
  st.markdown(f"## Examples of replaced sentences")
 
113
 
114
  # st.text(','.join(title_secret_languages).replace('<s>', '\<s\>'))
115
  # st.dataframe(dataframe)
116
  _num = Counter(data_title['tasks'])
117
- tab1, tab2, tab3 = st.tabs([f'NLI ({_num["NLI"]})', f'QA ({_num["QA"]})', f'Paraphrase ({_num["paraphrase"]})'])
118
 
119
 
120
  def present_dataframe(dataframe, key, title):
 
106
  present_sl_task(secret_language_by_task, 'QA')
107
  present_sl_task(secret_language_by_task, 'Paraphrase')
108
 
109
+ st.markdown(f"\**Hyperlinks only function when the corresponding tab is open. "
110
+ f"For example, the hyperlinks in the paraphrase section will only work when the paraphrase tab is open. However, due to the container property of Hugging Face Space, the hyperlinks might be not able to function.*")
111
+ st.markdown('\**Due to the grammatical properties of HTML, the layout of this page may vary.*')
112
  st.markdown(f"---")
113
  st.markdown(f"## Examples of replaced sentences")
114
+ st.markdown(f"The number following the tasks represents the number of examples found for a particular task, which may be different from the number of secret languages.")
115
 
116
  # st.text(','.join(title_secret_languages).replace('<s>', '\<s\>'))
117
  # st.dataframe(dataframe)
118
  _num = Counter(data_title['tasks'])
119
+ tab1, tab2, tab3 = st.tabs([f'NLI ({_num["NLI"]})', f'QA ({_num["QA"]})', f'Paraphrase ({_num["Paraphrase"]})'])
120
 
121
 
122
  def present_dataframe(dataframe, key, title):
pages/1_πŸ“™_Dictionary_(Browse).py CHANGED
@@ -36,23 +36,23 @@ with st.sidebar:
36
  cols0 = st.columns(8)
37
  for i in range(len(cols0)):
38
  with cols0[i]:
39
- # buttons[chr(65 + i)] = st.button(chr(65 + i))
40
- buttons[chr(65 + i)] = button(chr(65 + i), key=chr(65 + i))
41
  cols1 = st.columns(8)
42
  for i in range(len(cols1)):
43
  with cols1[i]:
44
- # buttons[chr(65 + 8 + i)] = st.button(chr(65 + 8 + i))
45
- buttons[chr(65 + 8 + i)] = button(chr(65 + 8 + i), key=chr(65 + 8 + i))
46
  cols2 = st.columns(8)
47
  for i in range(len(cols2)):
48
  with cols2[i]:
49
- # buttons[chr(65 + 16 + i)] = st.button(chr(65 + 16 + i))
50
- buttons[chr(65 + 16 + i)] = button(chr(65 + 16 + i), key=chr(65 + 16 + i))
51
  cols3 = st.columns(8)
52
  for i in range(2):
53
  with cols3[i]:
54
- # buttons[chr(65 + 24 + i)] = st.button(chr(65 + 24 + i))
55
- buttons[chr(65 + 24 + i)] = button(chr(65 + 24 + i), key=chr(65 + 24 + i))
56
  cols4 = st.columns(2)
57
  buttons['0-9'] = cols4[0].button('0-9')
58
  buttons['Others'] = cols4[1].button('Others')
@@ -95,14 +95,25 @@ with st.sidebar:
95
  # switch_page("dictionary (search)")
96
 
97
 
 
 
 
 
 
 
 
 
 
 
 
98
  # all_condition = False
99
  word_buttons = None
100
- all_word_button = {}
101
  for k in buttons:
102
  if buttons[k]:
103
- for _k in buttons:
104
- if _k != k:
105
- st.session_state[_k] = False
106
 
107
  word_buttons = []
108
  if k == '0-9':
@@ -132,12 +143,8 @@ for k in buttons:
132
  # st.markdown(f'<a href="Dictionary_(Search)?word={key}" target="_self">{key}</a>', unsafe_allow_html=True)
133
  # print(key)
134
  # word_buttons.append(st.button(f'{key}', key=key))
135
- all_word_button[key] = st.button(f'{key}', key=key)
136
  # all_word_button[key] = button(f'{key}', key=key)
137
- for key in all_word_button:
138
- if all_word_button[key]:
139
- st.session_state.click_word = key
140
- switch_page("dictionary (search)")
141
 
142
 
143
  # for _button in word_buttons:
 
36
  cols0 = st.columns(8)
37
  for i in range(len(cols0)):
38
  with cols0[i]:
39
+ buttons[chr(65 + i)] = st.button(chr(65 + i))
40
+ # buttons[chr(65 + i)] = button(chr(65 + i), key=chr(65 + i))
41
  cols1 = st.columns(8)
42
  for i in range(len(cols1)):
43
  with cols1[i]:
44
+ buttons[chr(65 + 8 + i)] = st.button(chr(65 + 8 + i))
45
+ # buttons[chr(65 + 8 + i)] = button(chr(65 + 8 + i), key=chr(65 + 8 + i))
46
  cols2 = st.columns(8)
47
  for i in range(len(cols2)):
48
  with cols2[i]:
49
+ buttons[chr(65 + 16 + i)] = st.button(chr(65 + 16 + i))
50
+ # buttons[chr(65 + 16 + i)] = button(chr(65 + 16 + i), key=chr(65 + 16 + i))
51
  cols3 = st.columns(8)
52
  for i in range(2):
53
  with cols3[i]:
54
+ buttons[chr(65 + 24 + i)] = st.button(chr(65 + 24 + i))
55
+ # buttons[chr(65 + 24 + i)] = button(chr(65 + 24 + i), key=chr(65 + 24 + i))
56
  cols4 = st.columns(2)
57
  buttons['0-9'] = cols4[0].button('0-9')
58
  buttons['Others'] = cols4[1].button('Others')
 
95
  # switch_page("dictionary (search)")
96
 
97
 
98
+ # st.markdown(st.session_state)
99
+ all_word_button = {}
100
+ # for key in all_word_button:
101
+ # if all_word_button[key]:
102
+ # st.session_state.click_word = key
103
+ # switch_page("dictionary (search)")
104
+ for k in st.session_state.keys():
105
+ if 'button_' in k:
106
+ st.session_state.click_word = k.split('button_')[-1]
107
+ switch_page("dictionary (search)")
108
+
109
  # all_condition = False
110
  word_buttons = None
111
+
112
  for k in buttons:
113
  if buttons[k]:
114
+ # for _k in buttons:
115
+ # if _k != k:
116
+ # st.session_state[_k] = False
117
 
118
  word_buttons = []
119
  if k == '0-9':
 
143
  # st.markdown(f'<a href="Dictionary_(Search)?word={key}" target="_self">{key}</a>', unsafe_allow_html=True)
144
  # print(key)
145
  # word_buttons.append(st.button(f'{key}', key=key))
146
+ all_word_button[key] = st.button(f'{key}', key=f'button_{key}')
147
  # all_word_button[key] = button(f'{key}', key=key)
 
 
 
 
148
 
149
 
150
  # for _button in word_buttons: