shrut27 commited on
Commit
48fd95e
โ€ข
1 Parent(s): 7f73f37

Upload 14 files

Browse files
Calorie_calculator.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ def app():
3
+ #st.set_page_config(page_title='Calorie Calculator for Korean Food')
4
+ st.title("Calorie Calculator for Korean Food")
5
+ st.write("Enter the name of a food item with the serving amount")
6
+ st.markdown("""
7
+ <style>
8
+ body {
9
+ color: #000;
10
+ background-color: #CF9FFF;
11
+ }
12
+ </style>
13
+ """, unsafe_allow_html=True)
14
+ import pandas as pd
15
+ df1 = pd.read_csv('Korean food_calorie__.csv',index_col=0)
16
+ dish = st.selectbox("Select the name of dish ",('Kimbap/๊น€๋ฐฅ','Tteokbokki/๋–ก๋ณถ์ด','Kalguksu/์นผ๊ตญ์ˆ˜','Gopchang-jeongol/๊ณฑ์ฐฝ์ „๊ณจ','Chadolbagi/์ฐจ๋Œ๋ฐ”๊ธฐ','Samgyeopsal/์‚ผ๊ฒน์‚ด','Panjeon/ํŒ์ „','Korean Tofu Kimchi Soup/๋‘๋ถ€ ๊น€์น˜์ฐŒ๊ฐœ','Samgetang/์‚ผ๊ณ„ํƒ•','Pork Ribs/๋ผ์ง€ ๊ฐˆ๋น„','Dumplings/๋งŒ๋‘','Carrots In Korean/๋‹น๊ทผ ํ•œ๊ตญ์–ด','Galbi Jjim/๊ฐˆ๋น„์ฐœ','Bibimbap/๋น„๋น”๋ฐฅ','Yeongyang dolsatbap/์˜์–‘ ๋Œ์†ฅ๋ฐฅ','Carrot Salad/๋‹น๊ทผ ์ƒ๋Ÿฌ๋“œ','Korean Food Lunch/ํ•œ์‹ ์ ์‹ฌ','Ddukbaegi Bulgogi/๋š๋ฐฐ๊ธฐ ๋ถˆ๊ณ ๊ธฐ','Jjamppong/์งฌ๋ฝ•','Octopus bibimbap/๋ฌธ์–ด๋น„๋น”๋ฐฅ','Sujebi/์ˆ˜์ œ๋น„','Dumpling Soup/๋งŒ๋‘ ์ˆ˜ํ”„','Yukgaejang/์œก๊ฐœ์žฅ','Beef bulgogi/์†Œ๋ถˆ๊ณ ๊ธฐ','Vegetable Dumbling/์•ผ์ฑ„ ๋ค๋ธ”๋ง','Bulgogi/๋ถˆ๊ณ ๊ธฐ','Korean cold noodles/ํ•œ๊ตญ ๋ƒ‰๋ฉด','Korean Eel soup/์žฅ์–ดํƒ•','Sundubu/์ˆœ๋‘๋ถ€','Korean Homemade food/ํ•œ๊ตญ ์ง‘์—์„œ ๋งŒ๋“  ์Œ์‹','Bibimnangmein/๋น„๋น”๋‚ญ๋งˆ์ธ','Bi Bim Bap/๋น„๋น”๋ฐฅ','Noodle/๊ตญ์ˆ˜','Galbi-tang /๊ฐˆ๋น„ํƒ•','Bibimbap With Beef/์†Œ๊ณ ๊ธฐ ๋น„๋น”๋ฐฅ','Ginseng Chicken Soup/์ธ์‚ผ ์น˜ํ‚จ ์ˆ˜ํ”„','Dwen Jang Jigae/๋“œ์›ฌ ์žฅ์ง€๊ฐœ','Korean Beef Noodles/ํ•œ์šฐ๊ตญ์ˆ˜','Tofu Kimchi/๋‘๋ถ€','Makchang/๋ง‰์ฐฝ','Steamed Monkfish/์•„๊ท€์ฐœ','Sundaegukbab/์ˆœ๋Œ€๊ตญ๋ฐฅ','Doganitang/๋„๊ฐ€๋‹ˆํƒ•','Bulgogi /๋ถˆ๊ณ ๊ธฐ','Eomukguk/์–ด๋ฌต๊ตญ','Soon Dae/์ˆœ๋Œ€','Sirloin Steak/๋“ฑ์‹ฌ ์Šคํ…Œ์ดํฌ','Oi Kimchi/์˜ค์ด ๊น€์น˜','Tempah/ํ…œํŒŒ','Seaweed Salad/๋ฏธ์—ญ ์ƒ๋Ÿฌ๋“œ','Hobbang/ํ˜ธ๋ฑ…','Broiled Eels/๊ตฌ์šด ์žฅ์–ด','Korean bbq/ํ•œ๊ตญ์‹ ๋ฐ”๋ฒ ํ','Nori/Seaweed/๊น€','Upjinsal roast/์›์ง„์‚ด ๊ตฌ์ด','Samgyupsal Pork Belly/์‚ผ๊ฒน์‚ด ์‚ผ๊ฒน์‚ด','JwiPo/์ฃผ์ดํฌ','Kim Bugak/๋ฏธ์—ญ ์Šค๋‚ต','Sogogi Youkgajang/์†Œ๊ณ ๊ธฐ์œก๊ฐ€์žฅ','Korean bbq marinade/ํ•œ๊ตญ์‹ ๋ฐ”๋ฒ ํ ๋งˆ๋ฆฌ๋„ค์ด๋“œ','Self heating food/์ž์ฒด ๊ฐ€์—ด ์‹ํ’ˆ','Korean Chicken Stir-Fry/ํ•œ๊ตญ ์น˜ํ‚จ ๋ณถ์Œ','Beef Intestine /์‡ ๊ณ ๊ธฐ ์ฐฝ์ž','Pork Bone Soup โ€“ Gamjatang/๊ฐ์žํƒ•','Ojingeo Deopbap/์˜ค์ง•์–ด๋ฎ๋ฐฅ','Ddukbokkie/๋–ก๋ณถ์ด','Dwenjanggigae/์›ฌ์žฅ๊ธฐ๊ฐœ','Ja Jang Myeon/์ž์žฅ๋ฉด','Doenjang Soup With Spinach/์‹œ๊ธˆ์น˜ ๋œ์žฅ๊ตญ','Korean Biscuit/ํ•œ๊ตญ ๊ณผ์ž','Seasoned Tofu /์–‘๋… ๋‘๋ถ€','Korean Short Rib Soup/ํ•œ์‹ ๊ฐˆ๋น„ํƒ•','Roasted Pork Belly /๊ตฌ์šด ์‚ผ๊ฒน์‚ด','Tteokguk/์ถ•ํ•˜ ์ˆ˜ํ”„','Korean beef/ํ•œ์šฐ','Dak kkochi/๋–ก๋ณถ์ด','Rice Cake Soup/๋–ก๊ตญ','Stuffed Cucumber Kimchi/์˜ค์ด ๋ฐ•์ œ ๊น€์น˜','Yeot/์ฏง์ฏง','Gim/๊น€','Triangular kimbap/์‚ผ๊ฐ๊น€๋ฐฅ','Baked Chub Mackerel/๊ตฌ์šด ๊ณ ๋“ฑ์–ด','Bebimbap/๋น„๋น”๋ฐฅ','Bread Ttoah/๋นต๋˜์•„','Korean seaweed/ํ•œ๊ตญ ํ•ด์ดˆ','Saeukkang/์ƒˆ๊ฐ•','Bread Ttoah/๋นต๋˜์•„','Korean seaweed/ํ•œ๊ตญ ํ•ด์ดˆ','Udon boeuf/์šฐ๋™๋ถ€ํ”„','Korean Kimchi/ํ•œ๊ตญ ๊น€์น˜','Korean Bbq/ํ•œ๊ตญ์‹ ๋ฐ”๋ฒ ํ','Dashida/๋‹ค์‹œ๋‹ค','Galbitang/๊ฐˆ๋น„ํƒ•','Kimchi/๊น€์น˜','Bibimbap vegetables/๋น„๋น”๋ฐฅ ์•ผ์ฑ„','Korean Chicken/ํ•œ๊ตญ ์น˜ํ‚จ','Sikhye/์‹ํ˜œ','Saeng Maekju/์ƒ๋งฅ์ฃผ','Patbingsu/ํŒฅ๋น™์ˆ˜','Tangpyeongchae/ํƒ•ํ‰์ฑ„'))
17
+ serving_ = st.number_input("Enter number of Servings")
18
+ try:
19
+ index_ = df1.index[df1['Name of the food']==dish].item()
20
+ except ValueError:
21
+ index_ = 1
22
+ else:
23
+ recipe_ = df1['Recipe'][index_]
24
+ cal_ = df1['Calories'][index_]
25
+ carb_ = df1['Carb(g)'][index_]
26
+ fat_ = df1['Fat (g)'][index_]
27
+ proteins_ = df1['Proteins(g)'][index_]
28
+ image_ = df1['Image'][index_]
29
+ kd = df1['Korean Description'][index_]
30
+ st.write("**Calorie count** ",round(cal_*serving_,2))
31
+ st.write("**Carbohydrate value** ",round(carb_*serving_,2))
32
+ st.write("**Fat value** ",round(fat_*serving_,2))
33
+ st.write("**Protein intake** ",round(proteins_*serving_,2))
34
+ st.write("**Recipe**",recipe_)
35
+ st.write("**Description in Korean**",kd)
36
+ st.image(image_,width=500)
37
+
JO_parsed.csv ADDED
The diff for this file is too large to render. See raw diff
 
Korean food_calorie.csv ADDED
The diff for this file is too large to render. See raw diff
 
Korean food_calorie__.csv ADDED
The diff for this file is too large to render. See raw diff
 
Procfile ADDED
@@ -0,0 +1 @@
 
 
1
+ web: sh setup.sh && streamlit run multiapp.py
README.md CHANGED
@@ -1,12 +1 @@
1
- ---
2
- title: Calorie Calculator
3
- emoji: ๐Ÿ’ป
4
- colorFrom: indigo
5
- colorTo: yellow
6
- sdk: streamlit
7
- sdk_version: 1.21.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+ # Calorie-Calculator
 
 
 
 
 
 
 
 
 
 
 
calorie_deficit.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import datetime
4
+ from datetime import date
5
+
6
+ def app():
7
+ st.title("Calorie Deficit Tracker")
8
+ st.markdown("""
9
+ <style>
10
+ body {
11
+ color: #000;
12
+ background-color: #CF9FFF;
13
+ }
14
+ </style>
15
+ """, unsafe_allow_html=True)
16
+ sweight = st.number_input("Enter the current weight in kilograms")
17
+ height = st.number_input("Enter the height in centimetres")
18
+ gender = st.selectbox("Enter the Gender",("Male","Female"))
19
+ age = st.number_input("Enter the age in years")
20
+ calfood = st.number_input("Enter the food calorie intake")
21
+ act = st.selectbox("Enter the type of lifestyle ",("Sedentary : Sitting most of the day with no structured exercise","Moderately active : Sedentary and low active job with 1 hr exercise daily or Active job (moderate movement 8+ hrs per day) but no structured exercise","Vigorously active : Active job (moderate movement 8+ hours per day) and 1 hr exercise per day or Sedentary or low active job but 2 hours of exercise daily","Extremely active : Training more than 2 hrs per day or Moderately active job (walking all day) plus at least 1 hr of exercise daily"))
22
+ if act=="Sedentary : Sitting most of the day with no structured exercise":
23
+ act = 1.55
24
+ elif act == "Moderately active : Sedentary and low active job with 1 hr exercise daily or Active job (moderate movement 8+ hrs per day) but no structured exercise":
25
+ act = 1.85
26
+ elif act == "Vigorously active : Active job (moderate movement 8+ hours per day) and 1 hr exercise per day or Sedentary or low active job but 2 hours of exercise daily":
27
+ act = 2.2
28
+ else:
29
+ act = 2.4
30
+ rmr_male = 88.362 + (13.397 * sweight) + (4.799 * height) - (5.677 * age)
31
+ rmr_female = 447.593 + (9.247 * sweight) + (3.098 * height) - (4.330 * age)
32
+ if gender == "Male":
33
+ bmr = 10 * sweight + 6.25 * height - 5 * age + 5
34
+ st.write("**Resting Metabolic Rate: **",round(rmr_male,2))
35
+ else:
36
+ bmr = 10 * sweight + 6.25 * height - 5 * age - 161
37
+ st.write("**Resting Metabolic Rate: **",round(rmr_female,2))
38
+ mcal = bmr * act
39
+ mcalw = mcal * 7
40
+ st.write("**Calorie Deficit for the day: **",round(mcal,2))
41
+ app()
multiapp.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ st.set_page_config(page_title='Calorie Calculator')
3
+ import Calorie_calculator
4
+ import weightloss_tracker
5
+ import calorie_deficit
6
+ import rec_system
7
+ PAGES = {
8
+ "Calorie Calculator": Calorie_calculator,
9
+ "Calorie Deficit Calculator": calorie_deficit,
10
+ "Weight Loss Tracker": weightloss_tracker,
11
+ "Recommendation System": rec_system
12
+ }
13
+ st.sidebar.title('Calorie cum weight loss tracker')
14
+ selection = st.sidebar.radio("Go to", list(PAGES.keys()))
15
+ page = PAGES[selection]
16
+ page.app()
rec_system.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import nltk
2
+ import string
3
+ import ast
4
+ import re
5
+ import unidecode
6
+ import pandas as pd
7
+ import streamlit as st
8
+ import nltk
9
+ nltk.download('wordnet')
10
+ from nltk.stem import WordNetLemmatizer
11
+ from nltk.corpus import wordnet
12
+ from collections import Counter
13
+ from sklearn.metrics.pairwise import cosine_similarity
14
+ from sklearn.feature_extraction.text import TfidfVectorizer
15
+ import pickle
16
+ def ingredient_parser(ingreds):
17
+ measures = ['teaspoon', 't', 'tsp', 'tablespoon', 'T', 'tbl.', 'tb', 'tbsp.', 'fluid ounce', 'fl oz', 'gill', 'cup', 'c', 'pint', 'p', 'pt', 'fl pt', 'quart', 'q', 'qt', 'fl qt', 'gallon', 'g', 'gal', 'ml', 'milliliter', 'millilitre', 'cc', 'mL', 'l', 'liter', 'litre', 'L', 'dl', 'deciliter', 'decilitre', 'dL', 'bulb', 'level', 'heaped', 'rounded', 'whole', 'pinch', 'medium', 'slice', 'pound', 'lb', '#', 'ounce', 'oz', 'mg', 'milligram', 'milligramme', 'g', 'gram', 'gramme', 'kg', 'kilogram', 'kilogramme', 'x', 'of', 'mm', 'millimetre', 'millimeter', 'cm', 'centimeter', 'centimetre', 'm', 'meter', 'metre', 'inch', 'in', 'milli', 'centi', 'deci', 'hecto', 'kilo']
18
+ words_to_remove = ['fresh', 'oil', 'a', 'red', 'bunch', 'and', 'clove', 'or', 'leaf', 'chilly','chillies', 'large', 'extra', 'sprig', 'ground', 'handful', 'free', 'small', 'pepper', 'virgin', 'range', 'from', 'dried', 'sustainable', 'black', 'peeled', 'higher', 'welfare', 'seed', 'for', 'finely', 'freshly', 'sea', 'quality', 'white', 'ripe', 'few', 'piece', 'source', 'to', 'organic', 'flat', 'smoked', 'ginger', 'sliced', 'green', 'picked', 'the', 'stick', 'plain', 'plus', 'mixed', 'mint', 'bay', 'basil', 'your', 'cumin', 'optional', 'fennel', 'serve', 'mustard', 'unsalted', 'baby', 'paprika', 'fat', 'ask', 'natural', 'skin', 'roughly', 'into', 'such', 'cut', 'good', 'brown', 'grated', 'trimmed', 'oregano', 'powder', 'yellow', 'dusting', 'knob', 'frozen', 'on', 'deseeded', 'low', 'runny', 'balsamic', 'cooked', 'streaky', 'nutmeg', 'sage', 'rasher', 'zest', 'pin', 'groundnut', 'breadcrumb', 'turmeric', 'halved', 'grating', 'stalk', 'light', 'tinned', 'dry', 'soft', 'rocket', 'bone', 'colour', 'washed', 'skinless', 'leftover', 'splash', 'removed', 'dijon', 'thick', 'big', 'hot', 'drained', 'sized', 'chestnut', 'watercress', 'fishmonger', 'english', 'dill', 'caper', 'raw', 'worcestershire', 'flake', 'cider', 'cayenne', 'tbsp', 'leg', 'pine', 'wild', 'if', 'fine', 'herb', 'almond', 'shoulder', 'cube', 'dressing', 'with', 'chunk', 'spice', 'thumb', 'garam', 'new', 'little', 'punnet', 'peppercorn', 'shelled', 'saffron', 'other''chopped', 'salt', 'olive', 'taste', 'can', 'sauce', 'water', 'diced', 'package', 'italian', 'shredded', 'divided', 'parsley', 'vinegar', 'all', 'purpose', 'crushed', 'juice', 'more', 'coriander', 'bell', 'needed', 'thinly', 'boneless', 'half', 'thyme', 'cubed', 'cinnamon', 'cilantro', 'jar', 'seasoning', 'rosemary', 'extract', 'sweet', 'baking', 'beaten', 'heavy', 'seeded', 'tin', 'vanilla', 'uncooked', 'crumb', 'style', 'thin', 'nut', 'coarsely', 'spring', 'chili', 'cornstarch', 'strip', 'cardamom', 'rinsed', 'honey', 'cherry', 'root', 'quartered', 'head', 'softened', 'container', 'crumbled', 'frying', 'lean', 'cooking', 'roasted', 'warm', 'whipping', 'thawed', 'corn', 'pitted', 'sun', 'kosher', 'bite', 'toasted', 'lasagna', 'split', 'melted', 'degree', 'lengthwise', 'romano', 'packed', 'pod', 'anchovy', 'rom', 'prepared', 'juiced', 'fluid', 'floret', 'room', 'active', 'seasoned', 'mix', 'deveined', 'lightly', 'anise', 'thai', 'size', 'unsweetened', 'torn', 'wedge', 'sour', 'basmati', 'marinara', 'dark', 'temperature', 'garnish', 'bouillon', 'loaf', 'shell', 'reggiano', 'canola', 'parmigiano', 'round', 'canned', 'ghee', 'crust', 'long', 'broken', 'ketchup', 'bulk', 'cleaned', 'condensed', 'sherry', 'provolone', 'cold', 'soda', 'cottage', 'spray', 'tamarind', 'pecorino', 'shortening', 'part', 'bottle', 'sodium', 'cocoa', 'grain', 'french', 'roast', 'stem', 'link', 'firm', 'asafoetida', 'mild', 'dash', 'boiling']
19
+ if isinstance(ingreds, list):
20
+ ingredients = ingreds
21
+ else:
22
+ ingredients = ast.literal_eval(ingreds)
23
+ translator = str.maketrans('', '', string.punctuation)
24
+ lemmatizer = WordNetLemmatizer()
25
+ ingred_list = []
26
+ for i in ingredients:
27
+ i.translate(translator)
28
+ # We split up with hyphens as well as spaces
29
+ items = re.split(' |-', i)
30
+ # Get rid of words containing non alphabet letters
31
+ items = [word for word in items if word.isalpha()]
32
+ # Turn everything to lowercase
33
+ items = [word.lower() for word in items]
34
+ # remove accents
35
+ items = [unidecode.unidecode(word) for word in items] #''.join((c for c in unicodedata.normalize('NFD', items) if unicodedata.category(c) != 'Mn'))
36
+ # Lemmatize words so we can compare words to measuring words
37
+ items = [lemmatizer.lemmatize(word) for word in items]
38
+ # Gets rid of measuring words/phrases, e.g. heaped teaspoon
39
+ items = [word for word in items if word not in measures]
40
+ # Get rid of common easy words
41
+ items = [word for word in items if word not in words_to_remove]
42
+ if items:
43
+ ingred_list.append(' '.join(items))
44
+ ingred_list = " ".join(ingred_list)
45
+ return ingred_list
46
+ # load in tdidf model and encodings
47
+ def scorefunc(ingredients):
48
+ with open('tfidf_encodings.pkl', 'rb') as f:
49
+ tfidf_encodings = pickle.load(f)
50
+ with open('tfidf_model.pkl', "rb") as f:
51
+ tfidf = pickle.load(f)
52
+ # parse the ingredients using my ingredient_parser
53
+ try:
54
+ ingredients_parsed = ingredient_parser(ingredients)
55
+ except:
56
+ ingredients_parsed = ingredient_parser([ingredients])
57
+ # use our pretrained tfidf model to encode our input ingredients
58
+ ingredients_tfidf = tfidf.transform([ingredients_parsed])
59
+ # calculate cosine similarity between actual recipe ingreds and test ingreds
60
+ cos_sim = map(lambda x: cosine_similarity(ingredients_tfidf, x), tfidf_encodings)
61
+ scores = list(cos_sim)
62
+ return scores
63
+ def get_recommendations(N, scores):
64
+ # load in recipe dataset
65
+ df_recipes = pd.read_csv('JO_parsed.csv')
66
+ # order the scores with and filter to get the highest N scores(desc order)
67
+ top = sorted(range(len(scores)), key=lambda i: scores[i], reverse=True)[:N]
68
+ # create dataframe to load in recommendations
69
+ recommendation = pd.DataFrame(columns = ['Recipe', 'Ingredients', 'Score', 'Url'])
70
+ count = 0
71
+ for i in top:
72
+ recommendation.at[count, 'Recipe'] = df_recipes['recipe_name'][i]
73
+ recommendation.at[count, 'Ingredients'] = df_recipes['ingredients'][i]
74
+ recommendation.at[count, 'Url'] = df_recipes['recipe_urls'][i]
75
+ recommendation.at[count, 'Score'] = "{:.3f}".format(float(scores[i]))
76
+ count += 1
77
+ return recommendation
78
+ def app():
79
+ st.markdown("*Recipe Recommendation System*")
80
+ recipe_box = st.selectbox(
81
+ "Display the top 5 recommendations or pick a particular recipe",
82
+ ["Show the top picks", "Select a single recipe"],
83
+ )
84
+ if recipe_box =="Show the top picks":
85
+ N=5
86
+ else:
87
+ N=1
88
+ ing = st.text_input("Enter the ingredients you would like to cook with")
89
+ if ing:
90
+ scores = scorefunc(ing)
91
+ rec = get_recommendations(N,scores)
92
+ st.write("These are some recommendation(s) for you")
93
+ st.write(rec.head(N))
94
+
requirements.txt ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==4.1.0
2
+ blinker==1.4
3
+ dlib==19.22.1
4
+ face-recognition==1.3.0
5
+ gitdb==4.0.5
6
+ GitPython==3.1.11
7
+ html5lib==1.0.1
8
+ imbalanced-learn==0.7.0
9
+ ipaddr==2.2.0
10
+ ipykernel==5.3.4
11
+ ipython==7.15.0
12
+ ipython-genutils==0.2.0
13
+ ipywidgets==7.5.1
14
+ jupyter-client==6.1.7
15
+ jupyter-core==4.7.0
16
+ jupyterlab-pygments==0.1.2
17
+ MarkupSafe==1.1.1
18
+ matplotlib==3.2.2
19
+ nbclient==0.5.1
20
+ nltk==3.5
21
+ notebook==6.1.5
22
+ numpy==1.19.4
23
+ pandas==1.1.4
24
+ pathtools==0.1.2
25
+ pickleshare==0.7.5
26
+ Pillow==8.0.1
27
+ pip==21.3.0
28
+ pycparser==2.20
29
+ pydeck==0.5.0
30
+ Pygments==2.7.2
31
+ pyparsing==2.4.7
32
+ pyrsistent==0.17.3
33
+ python-dateutil==2.8.1
34
+ pytoml==0.1.21
35
+ pytz==2020.4
36
+ pyzmq==20.0.0
37
+ six==1.15.0
38
+ scikit-learn==0.23.2
39
+ streamlit==0.71.0
40
+ unidecode==1.3.2
41
+ urllib3==1.26.2
42
+ validators==0.18.1
43
+ watchdog==0.10.4
44
+ webencodings==0.5.1
45
+ widgetsnbextension==3.5.1
setup.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ mkdir -p ~/.streamlit
2
+
3
+ echo "[server]
4
+ headless = true
5
+ port = $PORT
6
+ enableCORS = false
7
+ " > ~/.streamlit/config.toml
tfidf_encodings.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c75868951060ee04bbd6b35d5884d7248dead1785923401ce2abd6e0e5fa53c7
3
+ size 132948
tfidf_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe36aa25df7cdb05145c6b400a0afe26054ee14b2019e8f6552de343c0860107
3
+ size 42698
weightloss_tracker.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import datetime
4
+ from datetime import date
5
+ def shortcut():
6
+ scval = st.beta_expander("Information about Calories Burnt",False)
7
+ scval.markdown("**Walking**")
8
+ scval.markdown("1 Hour--> 350 Cal")
9
+ scval.markdown("1,000 Steps-->60 Cal")
10
+ scval.markdown("10,000 Steps-->600 Cal")
11
+ scval.markdown("**Running at an average speed**")
12
+ scval.markdown("1 Mile--> 100 Cal")
13
+ scval.markdown("1 KM-->60 Cal")
14
+ scval.markdown("5 Miles-->500 Cal")
15
+ scval.markdown("5 KM-->300 Cal")
16
+ scval.markdown("**Swimming at a slow pace**")
17
+ scval.markdown("1 Hour--> 500 Cal")
18
+ scval.markdown("1 Lap of 50m Pool-->25 Cal")
19
+ scval.markdown("**Swimming at a fast pace**")
20
+ scval.markdown("1 Hour--> 750 Cal")
21
+ scval.markdown("1 Lap of 50m Pool-->50 Cal")
22
+ scval.markdown("**Gym Workout for 1 Hour**")
23
+ scval.markdown("Light workout--> 200 Cal")
24
+ scval.markdown("Medium workout--> 350 Cal")
25
+ scval.markdown("Heavy workout--> 500 Cal")
26
+ scval.markdown("**Bike Ride for 1 Hour**")
27
+ scval.markdown("At 20 Km/hr or 13 Miles/hr--> 600 Cal")
28
+ scval.markdown("At 25 Km/hr or 16 Miles/hr--> 740 Cal")
29
+ scval1 = st.beta_expander("Information about Calorie Intake",False)
30
+ scval1.markdown("**Average general Calorie intake--> 2000-2500 Cal**")
31
+ scval1.markdown("**No. of Calorie Deficit required to lose 1 kg--> 7800 Cal**")
32
+ scval1.markdown("**Deficit of 1,100 cals per day --> 1 kg loss per week**")
33
+ scval1.markdown("**Daily loss for 2 kg per week is 0.3 kg per day**")
34
+ scval1.markdown("**1 kg of fat--> 7,500 calories**")
35
+ scval1.markdown("Calories for 2 small meals--> 1000 Cal")
36
+ scval1.markdown("Calories for 3 small meals--> 1800 Cal")
37
+ scval1.markdown("Apple, orange or banana--> 100 Cal")
38
+ scval1.markdown("Muesli with 1 cup of milk--> 500 Cal")
39
+ scval1.markdown("Fish 400 g with salad--> 600 Cal")
40
+ scval1.markdown("Steak 300 g with salad--> 800 Cal")
41
+ def func(val,sweight,height,gender,age,lr,cw,calfood,calburn):
42
+ st.write("**Days from the Start: **",val)
43
+ target_t = sweight - (val*lr)/7
44
+ st.write("**Start Weight: **",sweight)
45
+ st.write("**Target Today: **",round(target_t,2))
46
+ prg = target_t - cw
47
+ if prg>0:
48
+ st.write("**Progress: Ahead of target by **",round(prg,2)," **kg**")
49
+ else:
50
+ st.write("**Progress: Behind target by **",round(prg,2)," **kg**")
51
+ rmr_male = 88.362 + (13.397 * cw) + (4.799 * height) - (5.677 * age)
52
+ rmr_female = 447.593 + (9.247 * cw) + (3.098 * height) - (4.330 * age)
53
+ if gender =="Male":
54
+ cd = rmr_male + calburn - calfood
55
+ st.write("**Resting Metabolic Rate: **",round(rmr_male,2))
56
+ else:
57
+ cd = rmr_female + calburn - calfood
58
+ st.write("**Resting Metabolic Rate: **",round(rmr_female,2))
59
+ st.write("**Calorie Deficit: **",round(cd,2))
60
+ loss_exp = cd/7500
61
+ st.write("**Loss Expected: **",round(loss_exp,2))
62
+ st.markdown("____")
63
+ shortcut()
64
+ def app():
65
+ st.title("Weight Loss Tracker")
66
+ st.markdown("""
67
+ <style>
68
+ body {
69
+ color: #000;
70
+ background-color: #CF9FFF;
71
+ }
72
+ </style>
73
+ """, unsafe_allow_html=True)
74
+ date = st.date_input("Enter the start date",datetime.date(2022, 1, 1))
75
+ sweight = st.number_input("Enter the start weight in kilograms")
76
+ height = st.number_input("Enter the height in centimetres")
77
+ gender = st.selectbox("Enter the Gender",("Male","Female"))
78
+ age = st.number_input("Enter the age in years")
79
+ lr = st.number_input("Enter the loss rate(in kgs) per week")
80
+ cw = st.number_input("Enter the weight now")
81
+ calfood = st.number_input("Enter the food calorie intake")
82
+ calburn = st.number_input("Enter the calories burnt")
83
+ cdate = datetime.date.today()
84
+ if cdate == date:
85
+ val = 1
86
+ func(val,sweight,height,gender,age,lr,cw,calfood,calburn)
87
+ elif cdate>date:
88
+ delta = cdate - date
89
+ val = delta.days
90
+ func(val,sweight,height,gender,age,lr,cw,calfood,calburn)
91
+ else:
92
+ st.write("** Please select a Start date before current date**")
93
+
94
+
95
+
96
+
97
+
98
+
99
+