Spaces:
Running
Running
Fredrik Sitje
commited on
Commit
Β·
ecf7479
1
Parent(s):
03295c3
Updated skipping logic.
Browse files- src/streamlit_app.py +5 -0
src/streamlit_app.py
CHANGED
|
@@ -167,6 +167,7 @@ def save_users(users):
|
|
| 167 |
st.error(f"β **Error saving users to Hugging Face Dataset**: {str(e)}")
|
| 168 |
raise
|
| 169 |
|
|
|
|
| 170 |
def load_user_data(username):
|
| 171 |
"""Load user's answer data from Hugging Face Dataset"""
|
| 172 |
try:
|
|
@@ -205,6 +206,10 @@ def save_user_data(username, user_df, commit_message=None):
|
|
| 205 |
|
| 206 |
hf_api.upload_file(**upload_kwargs)
|
| 207 |
os.unlink(temp_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
return True
|
| 209 |
except Exception as e:
|
| 210 |
st.error(f"β **Error saving user data to Hugging Face Dataset**: {str(e)}")
|
|
|
|
| 167 |
st.error(f"β **Error saving users to Hugging Face Dataset**: {str(e)}")
|
| 168 |
raise
|
| 169 |
|
| 170 |
+
@st.cache_data(ttl=3600) # Cache for 1 hour as safety measure
|
| 171 |
def load_user_data(username):
|
| 172 |
"""Load user's answer data from Hugging Face Dataset"""
|
| 173 |
try:
|
|
|
|
| 206 |
|
| 207 |
hf_api.upload_file(**upload_kwargs)
|
| 208 |
os.unlink(temp_path)
|
| 209 |
+
|
| 210 |
+
# Clear cache for this user to ensure fresh data on next load
|
| 211 |
+
load_user_data.clear(username)
|
| 212 |
+
|
| 213 |
return True
|
| 214 |
except Exception as e:
|
| 215 |
st.error(f"β **Error saving user data to Hugging Face Dataset**: {str(e)}")
|