Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -366,37 +366,37 @@ def render_rupture_markers_widget(index: int, choices: list[str]):
|
|
| 366 |
if st.session_state.get(marker_key) is not None else 0
|
| 367 |
)
|
| 368 |
with col2:
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
st.text_input(f"Lines: from", key=a_key, value=st.session_state.get(a_key, ""))
|
| 373 |
with col3:
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
st.text_input(f"Lines: to", key=b_key, value=st.session_state.get(b_key, ""))
|
| 378 |
|
| 379 |
st.markdown("---")
|
| 380 |
|
| 381 |
a_col, b_col = st.columns([1, 1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
with a_col:
|
| 383 |
-
|
| 384 |
"➕ Add another rupture marker",
|
| 385 |
disabled=(count >= MAX_RUPTURE_MARKERS),
|
|
|
|
| 386 |
)
|
| 387 |
with b_col:
|
| 388 |
-
|
| 389 |
"➖ Remove last",
|
| 390 |
disabled=(count <= 1),
|
|
|
|
| 391 |
)
|
| 392 |
|
| 393 |
-
if add_clicked and count < MAX_RUPTURE_MARKERS:
|
| 394 |
-
st.session_state[count_key] = count + 1
|
| 395 |
-
st.rerun()
|
| 396 |
-
if remove_clicked and count > 1:
|
| 397 |
-
st.session_state[count_key] = count - 1
|
| 398 |
-
st.rerun()
|
| 399 |
-
|
| 400 |
st.caption(f"{st.session_state[count_key]}/{MAX_RUPTURE_MARKERS} markers")
|
| 401 |
|
| 402 |
#################################### Streamlit App ####################################
|
|
|
|
| 366 |
if st.session_state.get(marker_key) is not None else 0
|
| 367 |
)
|
| 368 |
with col2:
|
| 369 |
+
st.number_input("Lines: from", min_value=0, step=1, key=a_key) \
|
| 370 |
+
if RUPTURE_LINE_INPUT_TYPE == "number" \
|
| 371 |
+
else st.text_input("Lines: from", key=a_key, value=st.session_state.get(a_key, ""))
|
|
|
|
| 372 |
with col3:
|
| 373 |
+
st.number_input("Lines: to", min_value=0, step=1, key=b_key) \
|
| 374 |
+
if RUPTURE_LINE_INPUT_TYPE == "number" \
|
| 375 |
+
else st.text_input("Lines: to", key=b_key, value=st.session_state.get(b_key, ""))
|
|
|
|
| 376 |
|
| 377 |
st.markdown("---")
|
| 378 |
|
| 379 |
a_col, b_col = st.columns([1, 1])
|
| 380 |
+
|
| 381 |
+
def _inc():
|
| 382 |
+
st.session_state[count_key] = min(MAX_RUPTURE_MARKERS, st.session_state[count_key] + 1)
|
| 383 |
+
|
| 384 |
+
def _dec():
|
| 385 |
+
st.session_state[count_key] = max(1, st.session_state[count_key] - 1)
|
| 386 |
+
|
| 387 |
with a_col:
|
| 388 |
+
st.form_submit_button(
|
| 389 |
"➕ Add another rupture marker",
|
| 390 |
disabled=(count >= MAX_RUPTURE_MARKERS),
|
| 391 |
+
on_click=_inc,
|
| 392 |
)
|
| 393 |
with b_col:
|
| 394 |
+
st.form_submit_button(
|
| 395 |
"➖ Remove last",
|
| 396 |
disabled=(count <= 1),
|
| 397 |
+
on_click=_dec,
|
| 398 |
)
|
| 399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
st.caption(f"{st.session_state[count_key]}/{MAX_RUPTURE_MARKERS} markers")
|
| 401 |
|
| 402 |
#################################### Streamlit App ####################################
|