Spaces:
Runtime error
Runtime error
Delete unused code in utils.py
Browse files- src/utils.py +0 -27
src/utils.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
|
| 3 |
-
with open('Category-tree.json') as f:
|
| 4 |
-
cat_data = json.load(f)
|
| 5 |
-
|
| 6 |
-
candidate_labels = ['BEVERAGES', 'SNACKS & BRANDED FOODS', 'NOT FOUND', 'EGGS, MEAT & FISH',
|
| 7 |
-
'FOODGRAINS, OIL & MASALA', 'PERSONAL CARE', 'CLEANING & HOUSEHOLD',
|
| 8 |
-
'FRUITS & VEGETABLES', 'BAKERY, CAKES & DAIRY', 'MAKEUP', 'BABY CARE',
|
| 9 |
-
'PET FOOD & ACCESSORIES', 'NON FMCG', 'TOBACCO', 'WELLNESS', 'ALCOHOLIC BEVERAGES']
|
| 10 |
-
|
| 11 |
-
def get_childs(parent):
|
| 12 |
-
catagories = []
|
| 13 |
-
for category in cat_data:
|
| 14 |
-
if category['name'] == parent:
|
| 15 |
-
for child in category['children']:
|
| 16 |
-
catagories.append(child['name'])
|
| 17 |
-
return catagories
|
| 18 |
-
|
| 19 |
-
def get_inner_child(to_find_parent,to_find_child):
|
| 20 |
-
catagories = []
|
| 21 |
-
for parent in cat_data:
|
| 22 |
-
if parent['name'] == to_find_parent:
|
| 23 |
-
for child in parent['children']:
|
| 24 |
-
if child['name'] == to_find_child:
|
| 25 |
-
for inner_child in child['children']:
|
| 26 |
-
catagories.append(inner_child['name'])
|
| 27 |
-
return catagories
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|