khaerens commited on
Commit
3522491
·
1 Parent(s): d12268b
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -29,6 +29,8 @@ free_text_state_variables = {
29
 
30
  }
31
 
 
 
32
  def wiki_init_state_variables():
33
  for k in free_text_state_variables.keys():
34
  if k in st.session_state:
@@ -161,7 +163,7 @@ def show_wiki_hub_page():
161
 
162
  if len(st.session_state['wiki_suggestions']) != 0:
163
  num_buttons = len(st.session_state['wiki_suggestions'])
164
- num_cols = num_buttons if 0 < num_buttons < 8 else 8
165
  columns = st.columns([1] * num_cols )
166
  for q in range(1 + num_buttons//num_cols):
167
  for i, (c, s) in enumerate(zip(columns, st.session_state['wiki_suggestions'][q*num_cols: (q+1)*num_cols])):
@@ -189,7 +191,7 @@ def show_wiki_hub_page():
189
 
190
  components.html(st.session_state["html_wiki"], width=720, height=600)
191
  num_buttons = len(st.session_state["nodes"])
192
- num_cols = num_buttons if 0 < num_buttons < 7 else 7
193
  columns = st.columns([1] * num_cols + [1])
194
 
195
  for q in range(1 + num_buttons//num_cols):
 
29
 
30
  }
31
 
32
+ BUTTON_COLUMS = 5
33
+
34
  def wiki_init_state_variables():
35
  for k in free_text_state_variables.keys():
36
  if k in st.session_state:
 
163
 
164
  if len(st.session_state['wiki_suggestions']) != 0:
165
  num_buttons = len(st.session_state['wiki_suggestions'])
166
+ num_cols = num_buttons if 0 < num_buttons < BUTTON_COLUMS else BUTTON_COLUMS
167
  columns = st.columns([1] * num_cols )
168
  for q in range(1 + num_buttons//num_cols):
169
  for i, (c, s) in enumerate(zip(columns, st.session_state['wiki_suggestions'][q*num_cols: (q+1)*num_cols])):
 
191
 
192
  components.html(st.session_state["html_wiki"], width=720, height=600)
193
  num_buttons = len(st.session_state["nodes"])
194
+ num_cols = num_buttons if 0 < num_buttons < BUTTON_COLUMS else BUTTON_COLUMS
195
  columns = st.columns([1] * num_cols + [1])
196
 
197
  for q in range(1 + num_buttons//num_cols):