Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import web3
|
|
| 6 |
total_number_pages = 7
|
| 7 |
placeholder_buttons = None
|
| 8 |
|
| 9 |
-
Q3_radio_options = ["
|
| 10 |
Q4_radio_options = ["Option 1 Radio","Option 2 Radio"]
|
| 11 |
Q5_radio_options = ["Green","Red","Blue","Yellow"]
|
| 12 |
Q6_radio_options = ["Yes","No","Ur dumb"]
|
|
@@ -17,21 +17,8 @@ Q9_radio_options = ["IDK","Of Course","STFU!!!!!","Inner demons"]
|
|
| 17 |
def radio_change(element, state, key):
|
| 18 |
st.session_state[state] = element.index(st.session_state[key]) # Setting previously selected option
|
| 19 |
|
| 20 |
-
# Function that records radio element changes
|
| 21 |
def multi_change(element, state, key):
|
| 22 |
-
|
| 23 |
-
for selected_option in st.session_state[key]:
|
| 24 |
-
# Check if the selected option is in the element list
|
| 25 |
-
st.session_state[state].append(selected_option)
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
# Function that disables the last button while data is uploaded to IPFS
|
| 29 |
-
def button_disable():
|
| 30 |
-
st.session_state['disabled'] = True
|
| 31 |
-
|
| 32 |
-
def answer_change(state, key):
|
| 33 |
-
st.session_state[state] = st.session_state[key]
|
| 34 |
-
|
| 35 |
st.set_page_config(page_title='IPFS-Based Survey',)
|
| 36 |
st.title('Newest Test')
|
| 37 |
|
|
@@ -59,7 +46,8 @@ if st.session_state["current_page"] == 1:
|
|
| 59 |
st.video("https://www.youtube.com/watch?v=aJb6Dov0jlM")
|
| 60 |
|
| 61 |
st.text_area(label = "This is a text Question and should allow any text input. This should appear on the first page.",
|
| 62 |
-
value= "" if st.session_state["Q1"] == None else st.session_state["Q1"],
|
|
|
|
| 63 |
on_change = answer_change, args = ( "Q1", "Q1_text",))
|
| 64 |
|
| 65 |
# The code below changes the font size of the above radio's label.
|
|
@@ -94,10 +82,10 @@ elif st.session_state["current_page"] == 2:
|
|
| 94 |
|
| 95 |
|
| 96 |
st.multiselect(label = "This is a multiselect question where you can select multiple answers. This should appear on the second page.",
|
| 97 |
-
options = Q3_radio_options,
|
| 98 |
default = None if st.session_state["Q3"] == None else st.session_state["Q3"],
|
| 99 |
-
|
| 100 |
-
|
|
|
|
| 101 |
args = (Q3_radio_options, "Q3", "Q3_multi",))
|
| 102 |
|
| 103 |
# The code below changes the font size of the above radio's label.
|
|
@@ -153,8 +141,10 @@ elif st.session_state["current_page"] == 3:
|
|
| 153 |
|
| 154 |
|
| 155 |
st.multiselect(label = "Party Time",
|
|
|
|
| 156 |
options = Q6_radio_options,
|
| 157 |
key = 'Q6_multi',
|
|
|
|
| 158 |
args = (Q6_radio_options, "Q6", "Q6_multi",))
|
| 159 |
|
| 160 |
# The code below changes the font size of the above radio's label.
|
|
@@ -199,7 +189,8 @@ elif st.session_state["current_page"] == 4:
|
|
| 199 |
|
| 200 |
|
| 201 |
st.text_area(label = "Why are you this happy/unhappy?",
|
| 202 |
-
value= "" if st.session_state["Q8"] == None else st.session_state["Q8"],
|
|
|
|
| 203 |
on_change = answer_change, args = ( "Q8", "Q8_text",))
|
| 204 |
|
| 205 |
# The code below changes the font size of the above radio's label.
|
|
|
|
| 6 |
total_number_pages = 7
|
| 7 |
placeholder_buttons = None
|
| 8 |
|
| 9 |
+
Q3_radio_options = ["Option 1 multi","Option 2 multi"]
|
| 10 |
Q4_radio_options = ["Option 1 Radio","Option 2 Radio"]
|
| 11 |
Q5_radio_options = ["Green","Red","Blue","Yellow"]
|
| 12 |
Q6_radio_options = ["Yes","No","Ur dumb"]
|
|
|
|
| 17 |
def radio_change(element, state, key):
|
| 18 |
st.session_state[state] = element.index(st.session_state[key]) # Setting previously selected option
|
| 19 |
|
|
|
|
| 20 |
def multi_change(element, state, key):
|
| 21 |
+
st.session_state[state] = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
st.set_page_config(page_title='IPFS-Based Survey',)
|
| 23 |
st.title('Newest Test')
|
| 24 |
|
|
|
|
| 46 |
st.video("https://www.youtube.com/watch?v=aJb6Dov0jlM")
|
| 47 |
|
| 48 |
st.text_area(label = "This is a text Question and should allow any text input. This should appear on the first page.",
|
| 49 |
+
value= "" if st.session_state["Q1"] == None else st.session_state["Q1"],
|
| 50 |
+
key = 'Q1_text',
|
| 51 |
on_change = answer_change, args = ( "Q1", "Q1_text",))
|
| 52 |
|
| 53 |
# The code below changes the font size of the above radio's label.
|
|
|
|
| 82 |
|
| 83 |
|
| 84 |
st.multiselect(label = "This is a multiselect question where you can select multiple answers. This should appear on the second page.",
|
|
|
|
| 85 |
default = None if st.session_state["Q3"] == None else st.session_state["Q3"],
|
| 86 |
+
options = Q3_radio_options,
|
| 87 |
+
key = 'Q3_multi',
|
| 88 |
+
on_change = multi_change,
|
| 89 |
args = (Q3_radio_options, "Q3", "Q3_multi",))
|
| 90 |
|
| 91 |
# The code below changes the font size of the above radio's label.
|
|
|
|
| 141 |
|
| 142 |
|
| 143 |
st.multiselect(label = "Party Time",
|
| 144 |
+
default = None if st.session_state["Q6"] == None else st.session_state["Q6"],
|
| 145 |
options = Q6_radio_options,
|
| 146 |
key = 'Q6_multi',
|
| 147 |
+
on_change = multi_change,
|
| 148 |
args = (Q6_radio_options, "Q6", "Q6_multi",))
|
| 149 |
|
| 150 |
# The code below changes the font size of the above radio's label.
|
|
|
|
| 189 |
|
| 190 |
|
| 191 |
st.text_area(label = "Why are you this happy/unhappy?",
|
| 192 |
+
value= "" if st.session_state["Q8"] == None else st.session_state["Q8"],
|
| 193 |
+
key = 'Q8_text',
|
| 194 |
on_change = answer_change, args = ( "Q8", "Q8_text",))
|
| 195 |
|
| 196 |
# The code below changes the font size of the above radio's label.
|