Spaces:
Sleeping
Sleeping
Upload 6 files
Browse files
Derin Öğrenme Sınıflandırması ile Çok Sınıflı Obezite Riski Tahmini - Derin Öğrenme Sınıflandırması ile Çok Sınıflı Obezite Riski Tahmin.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Obezite.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a295b837d2204265fa7ebf9cef1c3347335d52b4259f5c687eb820eb92981721
|
| 3 |
+
size 677372
|
app.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import numpy as np
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import pickle
|
| 5 |
+
|
| 6 |
+
# Load the model and scaler
|
| 7 |
+
model = pickle.load(open('Obezite.pkl', 'rb'))
|
| 8 |
+
scaler = pickle.load(open('scaler.pkl', 'rb'))
|
| 9 |
+
|
| 10 |
+
st.title("Obesity Prediction")
|
| 11 |
+
|
| 12 |
+
# Input fields
|
| 13 |
+
gender = st.selectbox("Gender", ("Male", "Female"))
|
| 14 |
+
age = st.number_input("Age", min_value=0)
|
| 15 |
+
height = st.number_input("Height (m)", min_value=0.0)
|
| 16 |
+
weight = st.number_input("Weight (kg)", min_value=0.0)
|
| 17 |
+
cholesterol = st.number_input("Cholesterol Level", min_value=0)
|
| 18 |
+
blood_pressure = st.number_input("Blood Pressure", min_value=0)
|
| 19 |
+
smoking = st.selectbox("Smoking Status", ("Non-Smoker", "Smoker"))
|
| 20 |
+
alcohol_consumption = st.selectbox("Alcohol Consumption", ("No", "Yes"))
|
| 21 |
+
physical_activity = st.selectbox("Physical Activity Level", ("Low", "Moderate", "High"))
|
| 22 |
+
diet_quality = st.selectbox("Diet Quality", ("Poor", "Average", "Good"))
|
| 23 |
+
family_history_with_overweight = st.selectbox("Family History of Obesity", ("No", "Yes"))
|
| 24 |
+
FAVC = st.selectbox("Frequency of Eating Fatty Foods", ("No", "Yes"))
|
| 25 |
+
FCVC = st.number_input("Frequency of Vegetables Consumption", min_value=0)
|
| 26 |
+
NCP = st.number_input("Number of Main Meals", min_value=1)
|
| 27 |
+
CAEC = st.selectbox("Consumption of Food Between Meals", ("No", "Yes"))
|
| 28 |
+
CH2O = st.number_input("Water Consumption (L)", min_value=0.0)
|
| 29 |
+
SCC = st.number_input("Consumption of Sugar-Sweetened Beverages", min_value=0)
|
| 30 |
+
FAF = st.number_input("Physical Activity Level (1-5)", min_value=1, max_value=5)
|
| 31 |
+
TUE = st.number_input("Time Spent on Physical Activity", min_value=0)
|
| 32 |
+
CALC = st.selectbox("Caloric Intake", ("Low", "Moderate", "High"))
|
| 33 |
+
MTRANS = st.selectbox("Transportation Type", ("Walking", "Public Transport", "Private Vehicle"))
|
| 34 |
+
|
| 35 |
+
# Prepare input data for prediction
|
| 36 |
+
input_data = pd.DataFrame({
|
| 37 |
+
'Gender': [gender],
|
| 38 |
+
'Age': [age],
|
| 39 |
+
'Height': [height],
|
| 40 |
+
'Weight': [weight],
|
| 41 |
+
'family_history_with_overweight': [1 if family_history_with_overweight == "Yes" else 0],
|
| 42 |
+
'FAVC': [1 if FAVC == "Yes" else 0],
|
| 43 |
+
'FCVC': [FCVC],
|
| 44 |
+
'NCP': [NCP],
|
| 45 |
+
'CAEC': [1 if CAEC == "Yes" else 0],
|
| 46 |
+
'SMOKE': [1 if smoking == "Smoker" else 0],
|
| 47 |
+
'CH2O': [CH2O],
|
| 48 |
+
'SCC': [SCC],
|
| 49 |
+
'FAF': [FAF],
|
| 50 |
+
'TUE': [TUE],
|
| 51 |
+
'CALC': [CALC],
|
| 52 |
+
'MTRANS': [MTRANS],
|
| 53 |
+
})
|
| 54 |
+
|
| 55 |
+
# Convert categorical variables into dummy/indicator variables
|
| 56 |
+
input_data = pd.get_dummies(input_data, drop_first=True)
|
| 57 |
+
|
| 58 |
+
# Ensure the same features are present as in the scaler
|
| 59 |
+
input_data = input_data.reindex(columns=scaler.get_feature_names_out(), fill_value=0)
|
| 60 |
+
|
| 61 |
+
# Prediction button
|
| 62 |
+
if st.button('Predict'):
|
| 63 |
+
input_scaled = scaler.transform(input_data) # Scale the input data
|
| 64 |
+
prediction = model.predict(input_scaled) # Get the prediction
|
| 65 |
+
predicted_class = np.argmax(prediction, axis=1) # Get the predicted class
|
| 66 |
+
st.write(f"Predicted class: {predicted_class[0]}")
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
scikit-learn
|
| 3 |
+
pandas
|
| 4 |
+
tensorflow
|
scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6b416be148333fb8871df66f8abee5fb8b96b3121f4704e8395214070ba31e8
|
| 3 |
+
size 1741
|
train.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|