Spaces:
Sleeping
Sleeping
Commit ·
dcae8dc
1
Parent(s): ee2423f
Update app.py
Browse files
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 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 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':
|