adrianpierce commited on
Commit
131128e
·
1 Parent(s): 9930fcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -28,7 +28,9 @@ if 'bar_df' not in st.session_state:
28
  st.session_state.bar_df = bar_df
29
  st.session_state.bar_df_edited = st.session_state.bar_df.copy()
30
 
31
- with st.expander("Search and filter recipes"):
 
 
32
  # name search
33
  name_search = st.text_input('Search recipes by name')
34
  if name_search == "":
@@ -87,7 +89,7 @@ with st.expander("Search and filter recipes"):
87
  # st.session_state.filter_bar = recipes['name'].to_list()
88
 
89
 
90
- with st.expander("Home bar"):
91
  # input home bar
92
  st.session_state.bar_df_edited = st.data_editor(st.session_state.bar_df, disabled=["ingredients"], hide_index=True)
93
  if st.session_state.bar_df_edited['have'].sum() == 0:
@@ -104,8 +106,8 @@ with st.expander("Home bar"):
104
  # st.button(label='Submit Bar', on_click=submit_bar)
105
  # st.button(label='Reset', on_click=reset_bar)
106
 
107
- with st.expander("Find similar recipes"):
108
- st.selectbox("Select a recipe:", pd.concat([pd.Series('test'),recipes['name']]))
109
 
110
  def similarity(ratings, kind='user', epsilon=1e-9):
111
  if kind == 'user':
@@ -125,7 +127,7 @@ with st.expander("Find similar recipes"):
125
  recipe_similarity = pd.DataFrame(similarity(pivot_np, kind='user'))
126
  recipe_similarity.columns = pivot['name'].values
127
  recipe_similarity.index = pivot['name'].values
128
- #recipe_similarity
129
 
130
  st.header("Recipes")
131
  filter_all = list(set(filter_name) & set(filter_ingredient) & set(filter_source) & set(filter_type) & set(st.session_state.filter_bar))
 
28
  st.session_state.bar_df = bar_df
29
  st.session_state.bar_df_edited = st.session_state.bar_df.copy()
30
 
31
+ st.header("Recipe Finder")
32
+
33
+ with st.expander("Find recipes by searching and filtering"):
34
  # name search
35
  name_search = st.text_input('Search recipes by name')
36
  if name_search == "":
 
89
  # st.session_state.filter_bar = recipes['name'].to_list()
90
 
91
 
92
+ with st.expander("Find recipes by what you can make with your bar at home"):
93
  # input home bar
94
  st.session_state.bar_df_edited = st.data_editor(st.session_state.bar_df, disabled=["ingredients"], hide_index=True)
95
  if st.session_state.bar_df_edited['have'].sum() == 0:
 
106
  # st.button(label='Submit Bar', on_click=submit_bar)
107
  # st.button(label='Reset', on_click=reset_bar)
108
 
109
+ with st.expander("Find recipes that are similar to one another"):
110
+ simlar_select = st.selectbox("Select a recipe:", pd.concat([pd.Series('< SELECT AN OPTION >'),recipes['name']]))
111
 
112
  def similarity(ratings, kind='user', epsilon=1e-9):
113
  if kind == 'user':
 
127
  recipe_similarity = pd.DataFrame(similarity(pivot_np, kind='user'))
128
  recipe_similarity.columns = pivot['name'].values
129
  recipe_similarity.index = pivot['name'].values
130
+
131
 
132
  st.header("Recipes")
133
  filter_all = list(set(filter_name) & set(filter_ingredient) & set(filter_source) & set(filter_type) & set(st.session_state.filter_bar))