Commit ·
52773e5
1
Parent(s): aa2b69f
Bugfix - State not updated in front after clicking buttons
Browse files
app.py
CHANGED
|
@@ -17,13 +17,6 @@ if 'index' not in st.session_state:
|
|
| 17 |
if 'show_back' not in st.session_state:
|
| 18 |
st.session_state.show_back = False
|
| 19 |
|
| 20 |
-
front, back = flashcards_list[st.session_state.index]
|
| 21 |
-
|
| 22 |
-
st.markdown(f"### {front}")
|
| 23 |
-
|
| 24 |
-
if st.session_state.show_back:
|
| 25 |
-
st.info(back)
|
| 26 |
-
|
| 27 |
col1, col2 = st.columns(2)
|
| 28 |
|
| 29 |
with col1:
|
|
@@ -35,4 +28,11 @@ with col2:
|
|
| 35 |
st.session_state.index = (st.session_state.index + 1) % len(flashcards_list)
|
| 36 |
st.session_state.show_back = False
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
if 'show_back' not in st.session_state:
|
| 18 |
st.session_state.show_back = False
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
col1, col2 = st.columns(2)
|
| 21 |
|
| 22 |
with col1:
|
|
|
|
| 28 |
st.session_state.index = (st.session_state.index + 1) % len(flashcards_list)
|
| 29 |
st.session_state.show_back = False
|
| 30 |
|
| 31 |
+
front, back = flashcards_list[st.session_state.index]
|
| 32 |
+
|
| 33 |
+
st.markdown(f"### {front}")
|
| 34 |
+
|
| 35 |
+
if st.session_state.show_back:
|
| 36 |
+
st.info(back)
|
| 37 |
+
|
| 38 |
+
st.caption("Powered by HuggingFace Spaces + Streamlit ✨")
|