Spaces:
Running
Running
adrianpierce
commited on
Commit
•
64d25d9
1
Parent(s):
2366d7f
Update Home.py
Browse files
Home.py
CHANGED
@@ -127,7 +127,10 @@ def save_recipe():
|
|
127 |
with open(f'/data/{filename}.json', 'w') as f:
|
128 |
json.dump(recipe, f, indent=4)
|
129 |
st.session_state.recipe_saved = True
|
130 |
-
|
|
|
|
|
|
|
131 |
# app
|
132 |
st.title("Let's get cooking")
|
133 |
st.session_state.user_direction = st.text_area(
|
@@ -185,13 +188,14 @@ if selected_difficulty == "Professional":
|
|
185 |
|
186 |
|
187 |
user_inputs = {
|
188 |
-
"user_direction" : user_direction,
|
189 |
"exclusions": f"{exclusions}, {fancy_exclusions}",
|
190 |
"serving_size": serving_size,
|
191 |
"difficulty": selected_difficulty
|
192 |
}
|
193 |
|
194 |
st.button(label='Submit', on_click=generate_recipe, kwargs=dict(user_inputs=user_inputs), type="primary")
|
|
|
195 |
|
196 |
if st.session_state.gpt_response is not None:
|
197 |
st.divider()
|
|
|
127 |
with open(f'/data/{filename}.json', 'w') as f:
|
128 |
json.dump(recipe, f, indent=4)
|
129 |
st.session_state.recipe_saved = True
|
130 |
+
|
131 |
+
def clear_inputs():
|
132 |
+
st.session_state.user_direction = None
|
133 |
+
|
134 |
# app
|
135 |
st.title("Let's get cooking")
|
136 |
st.session_state.user_direction = st.text_area(
|
|
|
188 |
|
189 |
|
190 |
user_inputs = {
|
191 |
+
"user_direction" : st.session_state.user_direction,
|
192 |
"exclusions": f"{exclusions}, {fancy_exclusions}",
|
193 |
"serving_size": serving_size,
|
194 |
"difficulty": selected_difficulty
|
195 |
}
|
196 |
|
197 |
st.button(label='Submit', on_click=generate_recipe, kwargs=dict(user_inputs=user_inputs), type="primary")
|
198 |
+
st.button(label='Reset', on_click=clear_inputs, type="secondary")
|
199 |
|
200 |
if st.session_state.gpt_response is not None:
|
201 |
st.divider()
|