Spaces:
Sleeping
Sleeping
rmm
commited on
Commit
Β·
2c18274
1
Parent(s):
53eb5bc
fix: observations now persist across page switches
Browse files- src/home.py +3 -0
- src/input/input_handling.py +10 -2
src/home.py
CHANGED
|
@@ -20,6 +20,9 @@ if "MODE_DEV_STATEFUL" not in st.session_state:
|
|
| 20 |
from utils.st_logs import init_logging_session_states
|
| 21 |
init_logging_session_states() # logging init should be early
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
st.write("# Welcome to Cetacean Research Data Infrastructure! π¬ΛΛπ’Φ΄ΰ» πβ§Λ.β")
|
| 25 |
|
|
|
|
| 20 |
from utils.st_logs import init_logging_session_states
|
| 21 |
init_logging_session_states() # logging init should be early
|
| 22 |
|
| 23 |
+
# set email state var to exist, to permit persistence across page switches
|
| 24 |
+
if "input_author_email" not in st.session_state:
|
| 25 |
+
st.session_state.input_author_email = ""
|
| 26 |
|
| 27 |
st.write("# Welcome to Cetacean Research Data Infrastructure! π¬ΛΛπ’Φ΄ΰ» πβ§Λ.β")
|
| 28 |
|
src/input/input_handling.py
CHANGED
|
@@ -339,8 +339,16 @@ def _setup_oneoff_inputs() -> None:
|
|
| 339 |
|
| 340 |
with container_file_uploader:
|
| 341 |
# 1. Input the author email
|
| 342 |
-
|
| 343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
if author_email and not is_valid_email(author_email):
|
| 345 |
st.error("Please enter a valid email address.")
|
| 346 |
|
|
|
|
| 339 |
|
| 340 |
with container_file_uploader:
|
| 341 |
# 1. Input the author email
|
| 342 |
+
text0 = st.session_state.get("input_author_email", "None")
|
| 343 |
+
#print(f"[D] author email: {text0}")
|
| 344 |
+
author_email = st.text_input("Author Email",
|
| 345 |
+
value=st.session_state.get("input_author_email", None),
|
| 346 |
+
#spoof_metadata.get('author_email', ""),
|
| 347 |
+
#key="input_author_email")
|
| 348 |
+
)
|
| 349 |
+
# store the email in session state
|
| 350 |
+
st.session_state["input_author_email"] = author_email
|
| 351 |
+
|
| 352 |
if author_email and not is_valid_email(author_email):
|
| 353 |
st.error("Please enter a valid email address.")
|
| 354 |
|