Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -116,6 +116,7 @@ def reset_selections():
|
|
116 |
if menu == "Poll":
|
117 |
st.title("Breakfast Poll Application")
|
118 |
|
|
|
119 |
if st.session_state.step == 1:
|
120 |
st.header("Step 1: Enter your name")
|
121 |
name = st.text_input("Name:")
|
@@ -123,6 +124,7 @@ if menu == "Poll":
|
|
123 |
st.session_state.users.append(name)
|
124 |
st.session_state.step = 2
|
125 |
|
|
|
126 |
if st.session_state.step == 2:
|
127 |
st.header("Step 2: Select your drink(s)")
|
128 |
drinks_options = [
|
@@ -130,18 +132,27 @@ if menu == "Poll":
|
|
130 |
"Aguasusia", "Aguasusia susia", "Café descafeinado con leche desnatada",
|
131 |
"Italiano", "Café con soja", "Té", "Manzanilla", "Nada"
|
132 |
]
|
133 |
-
|
|
|
|
|
|
|
|
|
134 |
if st.button("Next", key="step2_next") and selected_drinks:
|
135 |
st.session_state.current_selections.append({"Name": st.session_state.users[-1], "Drinks": selected_drinks})
|
136 |
st.session_state.step = 3
|
137 |
|
|
|
138 |
if st.session_state.step == 3:
|
139 |
st.header("Step 3: Select your food(s)")
|
140 |
food_options = [
|
141 |
"Barrita con aceite", "Barrita con tomate", "Palmera de chocolate",
|
142 |
"Palmera de chocolate blanco", "Yogurt", "Pincho de tortilla", "Nada"
|
143 |
]
|
144 |
-
|
|
|
|
|
|
|
|
|
145 |
if st.button("Save Selections", key="save_selections") and selected_food:
|
146 |
st.session_state.current_selections[-1]["Food"] = selected_food
|
147 |
df = pd.DataFrame(st.session_state.current_selections)
|
|
|
116 |
if menu == "Poll":
|
117 |
st.title("Breakfast Poll Application")
|
118 |
|
119 |
+
# Step 1: User's Name
|
120 |
if st.session_state.step == 1:
|
121 |
st.header("Step 1: Enter your name")
|
122 |
name = st.text_input("Name:")
|
|
|
124 |
st.session_state.users.append(name)
|
125 |
st.session_state.step = 2
|
126 |
|
127 |
+
# Step 2: Select Drinks
|
128 |
if st.session_state.step == 2:
|
129 |
st.header("Step 2: Select your drink(s)")
|
130 |
drinks_options = [
|
|
|
132 |
"Aguasusia", "Aguasusia susia", "Café descafeinado con leche desnatada",
|
133 |
"Italiano", "Café con soja", "Té", "Manzanilla", "Nada"
|
134 |
]
|
135 |
+
|
136 |
+
# Wrap the multiselect dropdown in an expander for collapsible behavior
|
137 |
+
with st.expander("Choose your drinks:", expanded=True):
|
138 |
+
selected_drinks = st.multiselect("", drinks_options)
|
139 |
+
|
140 |
if st.button("Next", key="step2_next") and selected_drinks:
|
141 |
st.session_state.current_selections.append({"Name": st.session_state.users[-1], "Drinks": selected_drinks})
|
142 |
st.session_state.step = 3
|
143 |
|
144 |
+
# Step 3: Select Food
|
145 |
if st.session_state.step == 3:
|
146 |
st.header("Step 3: Select your food(s)")
|
147 |
food_options = [
|
148 |
"Barrita con aceite", "Barrita con tomate", "Palmera de chocolate",
|
149 |
"Palmera de chocolate blanco", "Yogurt", "Pincho de tortilla", "Nada"
|
150 |
]
|
151 |
+
|
152 |
+
# Wrap the multiselect dropdown in an expander for collapsible behavior
|
153 |
+
with st.expander("Choose your food:", expanded=True):
|
154 |
+
selected_food = st.multiselect("", food_options)
|
155 |
+
|
156 |
if st.button("Save Selections", key="save_selections") and selected_food:
|
157 |
st.session_state.current_selections[-1]["Food"] = selected_food
|
158 |
df = pd.DataFrame(st.session_state.current_selections)
|