Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import requests
|
|
| 3 |
import json
|
| 4 |
import web3
|
| 5 |
|
| 6 |
-
total_number_pages =
|
| 7 |
placeholder_buttons = None
|
| 8 |
|
| 9 |
|
|
@@ -34,6 +34,7 @@ st.markdown("<style>.big-font {font-size:24px;}</style>", unsafe_allow_html=True
|
|
| 34 |
if "current_page" not in st.session_state:
|
| 35 |
st.session_state["current_page"] = 1
|
| 36 |
st.session_state["Q1"] = None
|
|
|
|
| 37 |
st.session_state["disabled"] = False
|
| 38 |
|
| 39 |
# Page 1; Video
|
|
@@ -53,7 +54,7 @@ if st.session_state["current_page"] == 1:
|
|
| 53 |
|
| 54 |
placeholder = st.empty()
|
| 55 |
|
| 56 |
-
if st.button('Next'):
|
| 57 |
all_answered = True
|
| 58 |
if st.session_state["Q1"] == None:
|
| 59 |
all_answered = False
|
|
@@ -67,3 +68,35 @@ if st.session_state["current_page"] == 1:
|
|
| 67 |
st.progress(st.session_state["current_page"]/total_number_pages, text="Progress")
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import json
|
| 4 |
import web3
|
| 5 |
|
| 6 |
+
total_number_pages = 2
|
| 7 |
placeholder_buttons = None
|
| 8 |
|
| 9 |
|
|
|
|
| 34 |
if "current_page" not in st.session_state:
|
| 35 |
st.session_state["current_page"] = 1
|
| 36 |
st.session_state["Q1"] = None
|
| 37 |
+
st.session_state["Q2"] = None
|
| 38 |
st.session_state["disabled"] = False
|
| 39 |
|
| 40 |
# Page 1; Video
|
|
|
|
| 54 |
|
| 55 |
placeholder = st.empty()
|
| 56 |
|
| 57 |
+
if st.button('Next', key='next_button_page_1'):
|
| 58 |
all_answered = True
|
| 59 |
if st.session_state["Q1"] == None:
|
| 60 |
all_answered = False
|
|
|
|
| 68 |
st.progress(st.session_state["current_page"]/total_number_pages, text="Progress")
|
| 69 |
|
| 70 |
|
| 71 |
+
elif st.session_state["current_page"] == 2:
|
| 72 |
+
|
| 73 |
+
st.slider(label="Reg SLider",min_value=0,max_value=10,
|
| 74 |
+
value= 5 if st.session_state["Q2"] == None else st.session_state["Q2"],
|
| 75 |
+
key = "Q2_slider",
|
| 76 |
+
on_change = answer_change,
|
| 77 |
+
args = ("Q2", "Q2_slider",))
|
| 78 |
+
st.markdown("""<style> div[class*="stSlider"] > label > div[data-testid="stMarkdownContainer"] > p {font-size: 18px;}</style> <br><br>""", unsafe_allow_html=True)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
placeholder = st.empty()
|
| 82 |
+
|
| 83 |
+
col1, col2 = st.columns(2)
|
| 84 |
+
with col1:
|
| 85 |
+
if st.button('Back'):
|
| 86 |
+
st.session_state["current_page"] -= 1
|
| 87 |
+
st.rerun()
|
| 88 |
+
with col2:
|
| 89 |
+
if st.button('Next'):
|
| 90 |
+
all_answered = True
|
| 91 |
+
if st.session_state["Q2"] == None:
|
| 92 |
+
all_answered = False
|
| 93 |
+
if all_answered:
|
| 94 |
+
st.session_state["current_page"] += 1
|
| 95 |
+
st.rerun()
|
| 96 |
+
else:
|
| 97 |
+
with placeholder.container():
|
| 98 |
+
st.warning("Please answer all the questions on this page.", icon="⚠️")
|
| 99 |
+
|
| 100 |
+
st.progress(st.session_state["current_page"]/total_number_pages, text="Progress")
|
| 101 |
+
|
| 102 |
+
|