-
Notifications
You must be signed in to change notification settings - Fork 1
/
temp.py
50 lines (43 loc) · 1.61 KB
/
temp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import streamlit as st
import pandas as pd
import pickle as pkl
food = pd.read_csv('C:/Users/anany/Documents/GitHub/Hashcode_2022/data/calories.csv')
def calc_calories(breakfast,lunch,dinner):
cal = 0
df_cal = pd.read_csv("C:/Users/anany/Documents/GitHub/Hashcode_2022/data/calories.csv")
df_cal['Cals_per100grams'] = df_cal['Cals_per100grams'].str.replace(' cal','')
i = 0
for food in breakfast:
if (df_cal['FoodItem'][i] == food):
cal = cal + int(df_cal['Cals_per100grams'][i])
i = i + 1
i = 0
for food in lunch:
if (df_cal['FoodItem'][i] == food):
cal = cal + int(df_cal['Cals_per100grams'][i])
i = i + 1
i = 0
for food in dinner:
if (df_cal['FoodItem'][i] == food):
cal = cal + int(df_cal['Cals_per100grams'][i])
i = i + 1
return cal
fdu = food.FoodItem.unique()
with st.form("Food habits"):
# bf=st.radio("Did you eat breakfast today?", ["1:yes","2:no"])
breakfast=st.multiselect(label="Choose your food",options=fdu,key=1)
lunch=st.multiselect("Choose your food",fdu,key=2)
dinner=st.multiselect("Choose your food",fdu,key=3)
submi2 = st.form_submit_button("submit")
if(submi2):
cal = calc_calories(breakfast,lunch,dinner)
print(cal)
# temp=bf.split(":")
# boolBf= int(temp[0])-1
# rate=1
# hoursSlept=1
# StepsWalked=1
# user.update_user_progress(boolBf,breakfast,lunch,dinner,rate,hoursSlept,StepsWalked)
def get_mood(self):
with open('C:/Users/anany/Documents/GitHub/Hashcode_2022/model_pkl.pkl','rb') as f:
model = pkl.load(f)