adrianpierce commited on
Commit
e3b9f40
·
1 Parent(s): cbbe356

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -11,16 +11,14 @@ recipes_json = json.load(f)
11
  # prepare data
12
  recipes = pd.DataFrame(recipes_json)
13
  ingredients = pd.DataFrame(recipes_json).explode('ingredients')
14
-
15
- def get_bar_data():
16
- bar_dict = [{"ingredients":"rye", "have": False}, {"ingredients":"cognac", "have": False}]
17
- return pd.DataFrame(bar_dict)
18
-
19
  if 'filter_bar' not in st.session_state:
20
  st.session_state.filter_bar = recipes['name'].to_list()
21
 
22
  if 'bar_df' not in st.session_state:
23
- st.session_state.bar_df = get_bar_data()
24
  st.session_state.bar_df_edited = st.session_state.bar_df.copy()
25
 
26
  with st.expander("Search and filter recipes"):
@@ -87,7 +85,7 @@ def submit_bar():
87
 
88
  def reset_bar():
89
  st.session_state.filter_bar = recipes['name'].to_list()
90
- st.session_state.bar_df_edited['have'] = False
91
 
92
  with st.expander("Home bar"):
93
  bar_df = get_bar_data()
 
11
  # prepare data
12
  recipes = pd.DataFrame(recipes_json)
13
  ingredients = pd.DataFrame(recipes_json).explode('ingredients')
14
+ bar_dict = [{"ingredients":"rye", "have": False}, {"ingredients":"cognac", "have": False}]
15
+ bar_df = pd.DataFrame(bar_dict)
16
+
 
 
17
  if 'filter_bar' not in st.session_state:
18
  st.session_state.filter_bar = recipes['name'].to_list()
19
 
20
  if 'bar_df' not in st.session_state:
21
+ st.session_state.bar_df = bar_df
22
  st.session_state.bar_df_edited = st.session_state.bar_df.copy()
23
 
24
  with st.expander("Search and filter recipes"):
 
85
 
86
  def reset_bar():
87
  st.session_state.filter_bar = recipes['name'].to_list()
88
+ st.session_state.bar_df['have'] = False
89
 
90
  with st.expander("Home bar"):
91
  bar_df = get_bar_data()