adrianpierce commited on
Commit
dcae8dc
·
1 Parent(s): ee2423f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -10,13 +10,14 @@ f = open('data.json')
10
  recipes_json = json.load(f)
11
  recipes = pd.DataFrame(recipes_json)
12
  ingredients = pd.DataFrame(recipes_json).explode('ingredients')
13
- bar_dict = [
14
- {"ingredients":"rye", "have": False},
15
- {"ingredients":"cognac", "have": False},
16
- {"ingredients":"gin", "have": False},
17
- {"ingredients":"green chartreuse", "have": False},
18
- {"ingredients":"cointreau", "have": False}
19
- ]
 
20
  bar_df = pd.DataFrame(bar_dict)
21
  def similarity(ratings, kind='user', epsilon=1e-9):
22
  if kind == 'user':
 
10
  recipes_json = json.load(f)
11
  recipes = pd.DataFrame(recipes_json)
12
  ingredients = pd.DataFrame(recipes_json).explode('ingredients')
13
+ bar_list = ingredients.loc[ingredients['ingredients'].notnull(), 'ingredients'].unique().tolist()
14
+ bar_dict = []
15
+ for item in bar_list:
16
+ item_dict = {}
17
+ item_dict['ingredients'] = item
18
+ item_dict['have'] = False
19
+ bar_dict.append(item_dict)
20
+
21
  bar_df = pd.DataFrame(bar_dict)
22
  def similarity(ratings, kind='user', epsilon=1e-9):
23
  if kind == 'user':