Update my_pages/multiverse.py
Browse files- 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", "
|
| 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 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
|
|
|
| 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 +
|
| 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"]],
|