| import streamlit as st |
| import pandas as pd |
| import joblib |
|
|
| |
| model = joblib.load("src/calorie_catboost_model.pkl") |
|
|
| st.title("Calorie Expenditure Predictor") |
|
|
| st.write(""" |
| Bu uygulama yaş, cinsiyet, boy, kilo ve egzersiz bilgilerini kullanarak |
| yaklaşık yakılan kalori miktarını tahmin eder. |
| """) |
|
|
| sex = st.selectbox("Cinsiyet", ["Female", "Male"]) |
| age = st.slider("Yaş", 18, 80, 30) |
| height = st.slider("Boy (cm)", 120, 220, 170) |
| weight = st.slider("Kilo (kg)", 30, 150, 70) |
| duration = st.slider("Egzersiz Süresi (dakika)", 1, 30, 15) |
| heart_rate = st.slider("Kalp Atış Hızı", 60, 140, 90) |
| body_temp = st.slider("Vücut Sıcaklığı", 36.0, 42.0, 37.5) |
|
|
| sex = 1 if sex == "Male" else 0 |
|
|
| |
| bmi = weight / ((height / 100) ** 2) |
| heartrate_duration = heart_rate * duration |
| temp_duration = body_temp * duration |
| age_duration = age * duration |
|
|
| veri = pd.DataFrame({ |
| "Sex": [sex], |
| "Age": [age], |
| "Height": [height], |
| "Weight": [weight], |
| "Duration": [duration], |
| "Heart_Rate": [heart_rate], |
| "Body_Temp": [body_temp], |
| "BMI": [bmi], |
| "HeartRate_Duration": [heartrate_duration], |
| "Temp_Duration": [temp_duration], |
| "Age_Duration": [age_duration] |
| }) |
|
|
| if st.button("Tahmin Yap"): |
| tahmin = model.predict(veri)[0] |
|
|
| st.success( |
| f"Tahmini Yakılan Kalori: {tahmin:.2f} kcal" |
| ) |