Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -116,14 +116,15 @@ def reset_selections():
|
|
| 116 |
if menu == "Poll":
|
| 117 |
st.title("Breakfast Poll Application")
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
if
|
|
|
|
| 127 |
st.header("Step 2: Select your drink(s)")
|
| 128 |
drinks_options = [
|
| 129 |
"Café con leche", "Colacao", "Descafeinado con leche", "Cortado",
|
|
@@ -131,24 +132,27 @@ if menu == "Poll":
|
|
| 131 |
"Italiano", "Café con soja", "Té", "Manzanilla", "Nada"
|
| 132 |
]
|
| 133 |
selected_drinks = st.multiselect("Choose your drinks:", drinks_options)
|
|
|
|
| 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
|
|
|
|
| 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 |
selected_food = st.multiselect("Choose your food:", food_options)
|
|
|
|
| 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)
|
| 148 |
save_current_selection_to_file(df)
|
| 149 |
upload_temp_file_to_repo()
|
| 150 |
st.success(f"Selections saved for {st.session_state.users[-1]}!")
|
| 151 |
-
st.session_state.step = 1
|
| 152 |
|
| 153 |
# "Current" view to display the current summary of all users' selections and submit to history
|
| 154 |
elif menu == "Current":
|
|
|
|
| 116 |
if menu == "Poll":
|
| 117 |
st.title("Breakfast Poll Application")
|
| 118 |
|
| 119 |
+
# Step 1: User's Name
|
| 120 |
+
st.header("Step 1: Enter your name")
|
| 121 |
+
name = st.text_input("Name:")
|
| 122 |
+
if st.button("Next", key="step1_next") and name:
|
| 123 |
+
st.session_state.users.append(name)
|
| 124 |
+
st.session_state.step = 2 # Set the next step to be visible
|
| 125 |
+
|
| 126 |
+
# Show Step 2 only if Step 1 is completed
|
| 127 |
+
if st.session_state.step >= 2:
|
| 128 |
st.header("Step 2: Select your drink(s)")
|
| 129 |
drinks_options = [
|
| 130 |
"Café con leche", "Colacao", "Descafeinado con leche", "Cortado",
|
|
|
|
| 132 |
"Italiano", "Café con soja", "Té", "Manzanilla", "Nada"
|
| 133 |
]
|
| 134 |
selected_drinks = st.multiselect("Choose your drinks:", drinks_options)
|
| 135 |
+
|
| 136 |
if st.button("Next", key="step2_next") and selected_drinks:
|
| 137 |
st.session_state.current_selections.append({"Name": st.session_state.users[-1], "Drinks": selected_drinks})
|
| 138 |
+
st.session_state.step = 3 # Set the next step to be visible
|
| 139 |
|
| 140 |
+
# Show Step 3 only if Step 2 is completed
|
| 141 |
+
if st.session_state.step >= 3:
|
| 142 |
st.header("Step 3: Select your food(s)")
|
| 143 |
food_options = [
|
| 144 |
"Barrita con aceite", "Barrita con tomate", "Palmera de chocolate",
|
| 145 |
"Palmera de chocolate blanco", "Yogurt", "Pincho de tortilla", "Nada"
|
| 146 |
]
|
| 147 |
selected_food = st.multiselect("Choose your food:", food_options)
|
| 148 |
+
|
| 149 |
if st.button("Save Selections", key="save_selections") and selected_food:
|
| 150 |
st.session_state.current_selections[-1]["Food"] = selected_food
|
| 151 |
df = pd.DataFrame(st.session_state.current_selections)
|
| 152 |
save_current_selection_to_file(df)
|
| 153 |
upload_temp_file_to_repo()
|
| 154 |
st.success(f"Selections saved for {st.session_state.users[-1]}!")
|
| 155 |
+
st.session_state.step = 1 # Reset to step 1 for the next user
|
| 156 |
|
| 157 |
# "Current" view to display the current summary of all users' selections and submit to history
|
| 158 |
elif menu == "Current":
|