anonauthors commited on
Commit
7ef98e6
β€’
1 Parent(s): 2bbd295

Update pages/0_πŸ“™_Dictionary_(Search).py

Browse files
pages/0_πŸ“™_Dictionary_(Search).py CHANGED
@@ -10,7 +10,7 @@ from PyDictionary import PyDictionary
10
 
11
  dictionary = PyDictionary()
12
 
13
- st.set_page_config(layout="wide", page_title="ACl23 Secret Language")
14
 
15
  hide_expander_border = """
16
  <style>
@@ -18,7 +18,7 @@ hide_expander_border = """
18
  </style>
19
  """
20
 
21
- # st.title("Secret Language of LMs")
22
 
23
  # sidebar
24
  st.sidebar.header("πŸ“™ Dictionary")
@@ -34,7 +34,7 @@ for key in st.session_state.keys():
34
  if key != 'click_word':
35
  del st.session_state[key]
36
 
37
- title = st.sidebar.text_input(":red[Search secret languages given the following word (case-sensitive)]", default_title)
38
 
39
  st.sidebar.markdown("### Frequent FAQs")
40
  st.sidebar.markdown("1. :blue[*Why are words in sentences represented as subwords instead of complete words?*]<br>"
@@ -42,7 +42,7 @@ st.sidebar.markdown("1. :blue[*Why are words in sentences represented as subword
42
  unsafe_allow_html=True)
43
  st.sidebar.markdown("2. :blue[*This page is extremely slow. I cannot stand it.*]<br>"
44
  "We apologize for the slow performance of this page. We are actively working on improving it. "
45
- "As loading the data can take time and some words have many secret languages, this page needs time to process.",
46
  unsafe_allow_html=True)
47
  st.sidebar.markdown("3. :blue[*Why are some examples significantly different from the original sentences?*] <br>"
48
  "As per our submission, we replace 1 to 10 subwords in a sentence. However, for some examples with short lengths, the entire sentence may be altered. We are conducting experiments and will present examples where only a single subword has been changed.",
@@ -77,16 +77,16 @@ if title in datas:
77
  icon="🚨")
78
 
79
  # st.markdown(f"---")
80
- # st.markdown(f"## {title}'s secret languages")
81
  data_title = datas[title]
82
  # st.markdown(data_title.keys())
83
  title_secret_languages = list(sorted(list(set(data_title["secret languages"]))))
84
  # dataframe = pd.DataFrame(datas[title])
85
- # st.markdown(f'### We found {len(set(dataframe.loc[:, "secret languages"]))} secret languages of {title}.', unsafe_allow_html=True)
86
  # st.markdown(f'Overall, we found :red[{len(title_secret_languages)}] secret languages of :blue[{title}].',
87
  # unsafe_allow_html=True)
88
  colored_header(
89
- label=f"{title}'s secret languages",
90
  description=f'Overall, we found :red[{len(title_secret_languages)}] secret languages of :blue[{title}].',
91
  color_name="red-70",
92
  )
@@ -114,7 +114,7 @@ if title in datas:
114
  if all_sl[i] != '':
115
  new_all_sl.append(all_sl[i].replace("\n", "/n").strip())
116
  all_sl = sorted(new_all_sl)
117
- with st.expander(f'***{len(all_sl)}*** secret languages of ***{title}*** on {task.replace("paraphrase", "Paraphrase")}'):
118
  # st.markdown(
119
  # f':red[{len(all_sl)}] secret languages of :blue[{title}] on {task.replace("paraphrase", "Paraphrase")}',
120
  # unsafe_allow_html=True)
 
10
 
11
  dictionary = PyDictionary()
12
 
13
+ st.set_page_config(layout="wide", page_title="Obstinate Adversarial Examples")
14
 
15
  hide_expander_border = """
16
  <style>
 
18
  </style>
19
  """
20
 
21
+ # st.title("Obstinate Adversarial Examples Language of LMs")
22
 
23
  # sidebar
24
  st.sidebar.header("πŸ“™ Dictionary")
 
34
  if key != 'click_word':
35
  del st.session_state[key]
36
 
37
+ title = st.sidebar.text_input(":red[Search obstinate subsituitions given the following word (case-sensitive)]", default_title)
38
 
39
  st.sidebar.markdown("### Frequent FAQs")
40
  st.sidebar.markdown("1. :blue[*Why are words in sentences represented as subwords instead of complete words?*]<br>"
 
42
  unsafe_allow_html=True)
43
  st.sidebar.markdown("2. :blue[*This page is extremely slow. I cannot stand it.*]<br>"
44
  "We apologize for the slow performance of this page. We are actively working on improving it. "
45
+ "As loading the data can take time and some words have many obstinate subsituitions, this page needs time to process.",
46
  unsafe_allow_html=True)
47
  st.sidebar.markdown("3. :blue[*Why are some examples significantly different from the original sentences?*] <br>"
48
  "As per our submission, we replace 1 to 10 subwords in a sentence. However, for some examples with short lengths, the entire sentence may be altered. We are conducting experiments and will present examples where only a single subword has been changed.",
 
77
  icon="🚨")
78
 
79
  # st.markdown(f"---")
80
+ # st.markdown(f"## {title}'s obstinate subsituitions")
81
  data_title = datas[title]
82
  # st.markdown(data_title.keys())
83
  title_secret_languages = list(sorted(list(set(data_title["secret languages"]))))
84
  # dataframe = pd.DataFrame(datas[title])
85
+ # st.markdown(f'### We found {len(set(dataframe.loc[:, "secret languages"]))} obstinate subsituitions of {title}.', unsafe_allow_html=True)
86
  # st.markdown(f'Overall, we found :red[{len(title_secret_languages)}] secret languages of :blue[{title}].',
87
  # unsafe_allow_html=True)
88
  colored_header(
89
+ label=f"{title}'s obstinate subsituitions",
90
  description=f'Overall, we found :red[{len(title_secret_languages)}] secret languages of :blue[{title}].',
91
  color_name="red-70",
92
  )
 
114
  if all_sl[i] != '':
115
  new_all_sl.append(all_sl[i].replace("\n", "/n").strip())
116
  all_sl = sorted(new_all_sl)
117
+ with st.expander(f'***{len(all_sl)}*** obstinate subsituitions of ***{title}*** on {task.replace("paraphrase", "Paraphrase")}'):
118
  # st.markdown(
119
  # f':red[{len(all_sl)}] secret languages of :blue[{title}] on {task.replace("paraphrase", "Paraphrase")}',
120
  # unsafe_allow_html=True)