Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
chris1nexus
commited on
Commit
·
626d70f
1
Parent(s):
11542f8
Update default category
Browse files- src/streamlit_app.py +9 -1
src/streamlit_app.py
CHANGED
|
@@ -240,7 +240,8 @@ for key, default in {
|
|
| 240 |
"click_nonce": 0,
|
| 241 |
"last_clicked_processed": -1,
|
| 242 |
"auto_selected_ids": set(),
|
| 243 |
-
"image_view": "Original",
|
|
|
|
| 244 |
}.items():
|
| 245 |
if key not in st.session_state:
|
| 246 |
st.session_state[key] = default
|
|
@@ -399,6 +400,13 @@ if st.session_state.challenge_images_original:
|
|
| 399 |
st.session_state.image_view = st.radio(
|
| 400 |
"Image set", options, horizontal=True, index=0 if st.session_state.image_view not in options else options.index(st.session_state.image_view)
|
| 401 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
|
| 403 |
images_to_show = (st.session_state.challenge_images_modified
|
| 404 |
if st.session_state.image_view == "Modified" and st.session_state.challenge_images_modified
|
|
|
|
| 240 |
"click_nonce": 0,
|
| 241 |
"last_clicked_processed": -1,
|
| 242 |
"auto_selected_ids": set(),
|
| 243 |
+
"image_view": "Original", # current radio selection
|
| 244 |
+
"last_image_view": "Original", # previous radio selection
|
| 245 |
}.items():
|
| 246 |
if key not in st.session_state:
|
| 247 |
st.session_state[key] = default
|
|
|
|
| 400 |
st.session_state.image_view = st.radio(
|
| 401 |
"Image set", options, horizontal=True, index=0 if st.session_state.image_view not in options else options.index(st.session_state.image_view)
|
| 402 |
)
|
| 403 |
+
# If user switches Original ↔ Modified, treat as "new puzzle view"
|
| 404 |
+
prev_view = st.session_state.get("last_image_view", "Original")
|
| 405 |
+
if st.session_state.image_view != prev_view:
|
| 406 |
+
st.session_state.last_image_view = st.session_state.image_view
|
| 407 |
+
st.session_state.tile_selected = set()
|
| 408 |
+
st.session_state.auto_selected_ids = set()
|
| 409 |
+
st.session_state.click_nonce = 0
|
| 410 |
|
| 411 |
images_to_show = (st.session_state.challenge_images_modified
|
| 412 |
if st.session_state.image_view == "Modified" and st.session_state.challenge_images_modified
|