prakharg24 commited on
Commit
0adaec1
·
verified ·
1 Parent(s): 1588366

Update my_pages/multiverse.py

Browse files
Files changed (1) hide show
  1. my_pages/multiverse.py +9 -7
my_pages/multiverse.py CHANGED
@@ -112,7 +112,7 @@ def build_tree_and_trace_path(selected_path, spread_factor=10000):
112
 
113
 
114
  def render():
115
- add_navigation("txt_multiverse", "conclusion")
116
 
117
  add_instruction_text(
118
  """
@@ -122,12 +122,14 @@ def render():
122
  )
123
 
124
  # --- User picks one choice per stage via dropdowns ---
 
125
  selected_path = []
126
- for stage in choices_list:
127
- # use a stable key per stage to avoid conflicts
128
- key = f"multiverse_choice_{stage['label']}"
129
- choice = st.selectbox(f"{stage['label']}", stage["options"], key=key)
130
- selected_path.append(choice)
 
131
 
132
  # --- Build tree and compute which edges/nodes to highlight ---
133
  labels, positions, edges, highlight_edges, highlight_nodes = build_tree_and_trace_path(selected_path)
@@ -180,7 +182,7 @@ def render():
180
  # max y among these nodes
181
  max_y = max(positions[i][1] for i in stage_nodes)
182
  x = float(stage_idx)
183
- y = max_y + 0.5 * 10000 # offset above top node
184
  stage_label_traces.append(go.Scatter(
185
  x=[x], y=[y],
186
  text=[stage["label"]],
 
112
 
113
 
114
  def render():
115
+ add_navigation("txt_multiverse", "txt_conclusion")
116
 
117
  add_instruction_text(
118
  """
 
122
  )
123
 
124
  # --- User picks one choice per stage via dropdowns ---
125
+ cols_list = st.columns([1, 1])
126
  selected_path = []
127
+ for ite, stage in enumerate(choices_list):
128
+ with cols_list[ite%2]:
129
+ # use a stable key per stage to avoid conflicts
130
+ key = f"multiverse_choice_{stage['label']}"
131
+ choice = st.selectbox(f"{stage['label']}", stage["options"], key=key)
132
+ selected_path.append(choice)
133
 
134
  # --- Build tree and compute which edges/nodes to highlight ---
135
  labels, positions, edges, highlight_edges, highlight_nodes = build_tree_and_trace_path(selected_path)
 
182
  # max y among these nodes
183
  max_y = max(positions[i][1] for i in stage_nodes)
184
  x = float(stage_idx)
185
+ y = max_y + 10000 # offset above top node
186
  stage_label_traces.append(go.Scatter(
187
  x=[x], y=[y],
188
  text=[stage["label"]],