manma / app.py
ayush-goud's picture
Upload 4 files
ed26e7d verified
import streamlit as st
from model import predict_disease_risk # Import the prediction function from model.py
# Streamlit GUI
st.title('Health Risk Prediction Based on Diet')
# User inputs (as described in your previous code)
# Include the Streamlit code for user inputs here
# User inputs
age = st.selectbox('Age', options=[...]) # Populate with age categories
gender = st.selectbox('Gender', options=['Male', 'Female'])
meals_per_day = st.number_input('Number of meals per day', min_value=1, max_value=10)
diet = st.selectbox('Diet', options=['Pollotarian', 'Vegetarian', 'Pescatarian', 'Non-Vegetarian', 'Eggetarian'])
skip_meals = st.selectbox('Do you skip meals?', options=['Never', 'Rarely', 'Sometimes', 'Often', 'Very frequently'])
hunger = st.selectbox('Do you experience feelings of hunger during the day?', options=['Never', 'Rarely', 'Sometimes', 'Often', 'Very frequently'])
nutritionist = st.selectbox('Do you consult a nutritionist?', options=['Never', 'Rarely', 'Sometimes', 'Often', 'Very frequently'])
cook_meals = st.selectbox('Do you cook your own meals?', options=['Never', 'Rarely', 'Sometimes', 'Often', 'Very frequently'])
main_meal = st.selectbox('Main meal of the day', options=['Breakfast', 'Lunch', 'Dinner', 'All'])
diet_description = st.selectbox('Diet description', options=['Freshly home-cooked produce', 'Restaurant meals'])
# Collect all inputs in a dictionary
input_data = {
'Age': age,
'Gender': gender,
'How many meals do you have a day?': meals_per_day,
'What would best describe your diet': diet,
'Choose all that apply: [I skip meals]': skip_meals,
'Choose all that apply: [I experience feelings of hunger during the day]': hunger,
'Choose all that apply: [I consult a nutritionist/dietician]': nutritionist,
'Choose all that apply: [I cook my own meals]': cook_meals,
'What would you consider to be the main meal of YOUR day?': main_meal,
'What does your diet mostly consist of and how is it prepared?': diet_description,
}
# Prediction button
if st.button('Predict Disease Risk'):
prediction = predict_disease_risk(input_data)
st.write(f'Predicted Disease Risk: {prediction}')