adrianpierce commited on
Commit
3118a9b
·
1 Parent(s): 886eb90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -13
app.py CHANGED
@@ -96,7 +96,6 @@ with st.expander("Find recipes by name, ingredients, and type"):
96
  filter_1 = recipes['recipe_type'].isin(type_options)
97
  filter_type = recipes.loc[filter_1, 'name'].to_list()
98
 
99
-
100
  with st.expander("Find recipes by what you can make with your bar at home"):
101
  # input home bar
102
  st.session_state.bar_df_edited = st.data_editor(st.session_state.bar_df, disabled=["ingredients"], hide_index=True)
@@ -110,19 +109,10 @@ with st.expander("Find recipes by what you can make with your bar at home"):
110
  filter_2 = pivot['sum_needs_ingredients'] == pivot['sum_has_ingredients']
111
  filter_all = filter_1 & filter_2
112
  st.session_state.filter_bar = pivot.loc[filter_all, 'name'].to_list()
113
-
114
- # st.button(label='Submit Bar', on_click=submit_bar)
115
- # st.button(label='Reset', on_click=reset_bar)
116
 
117
  with st.expander("Find recipes that are similar to one another"):
118
- #simlar_select = st.selectbox("Select a recipe:", pd.concat([pd.Series(Null),recipes['name']]))
119
  similar_select = st.multiselect("Select a recipe:", recipes['name'], max_selections=1)
120
 
121
-
122
-
123
-
124
-
125
-
126
  # Recipes section
127
  st.header("Recipes")
128
  filter_all = list(set(filter_name) & set(filter_ingredient) & set(filter_source) & set(filter_type) & set(st.session_state.filter_bar))
@@ -135,8 +125,6 @@ if len(similar_select) > 0:
135
  .sort_values(by=similar_select, ascending=False) \
136
  .query('name in @filter_all'),
137
  column_config={similar_select[0]: st.column_config.NumberColumn('% similarity to selected')},
138
- hide_index=True) \
139
-
140
- #recipes[recipes['name'].isin(filter_all)]
141
  else:
142
  st.dataframe(recipes[recipes['name'].isin(filter_all)], hide_index=True)
 
96
  filter_1 = recipes['recipe_type'].isin(type_options)
97
  filter_type = recipes.loc[filter_1, 'name'].to_list()
98
 
 
99
  with st.expander("Find recipes by what you can make with your bar at home"):
100
  # input home bar
101
  st.session_state.bar_df_edited = st.data_editor(st.session_state.bar_df, disabled=["ingredients"], hide_index=True)
 
109
  filter_2 = pivot['sum_needs_ingredients'] == pivot['sum_has_ingredients']
110
  filter_all = filter_1 & filter_2
111
  st.session_state.filter_bar = pivot.loc[filter_all, 'name'].to_list()
 
 
 
112
 
113
  with st.expander("Find recipes that are similar to one another"):
 
114
  similar_select = st.multiselect("Select a recipe:", recipes['name'], max_selections=1)
115
 
 
 
 
 
 
116
  # Recipes section
117
  st.header("Recipes")
118
  filter_all = list(set(filter_name) & set(filter_ingredient) & set(filter_source) & set(filter_type) & set(st.session_state.filter_bar))
 
125
  .sort_values(by=similar_select, ascending=False) \
126
  .query('name in @filter_all'),
127
  column_config={similar_select[0]: st.column_config.NumberColumn('% similarity to selected')},
128
+ hide_index=True)
 
 
129
  else:
130
  st.dataframe(recipes[recipes['name'].isin(filter_all)], hide_index=True)