Spaces:
Runtime error
Runtime error
Download app.py from Adebc/Children_Nutrition: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/Adebc/Children_Nutrition/resolve/main/app.py
- Command line
-
hf download hf://spaces/Adebc/Children_Nutrition/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Adebc/Children_Nutrition/resolve/main/app.py
1.11 kB
| import streamlit as st | |
| import pandas as pd | |
| import joblib | |
| # Load the trained model | |
| # Make sure 'model.pkl' is in the same folder as this script | |
| def load_model(): | |
| return joblib.load("model.pkl") | |
| model = load_model() | |
| st.set_page_config(page_title="Children Nutrition Classifier", layout="centered") | |
| st.title("Children Nutrition Classifier") | |
| st.write("This app predicts the nutritional status of a child using basic health indicators.") | |
| # Input form | |
| with st.form("input_form"): | |
| age = st.number_input("Age (months)", min_value=0, max_value=120, value=12, step=1) | |
| weight = st.number_input("Weight (kg)", min_value=1.0, max_value=50.0, value=10.0, step=0.1) | |
| height = st.number_input("Height (cm)", min_value=40.0, max_value=150.0, value=75.0, step=0.1) | |
| submit = st.form_submit_button("Predict") | |
| if submit: | |
| # Match training features (adjust names if your model expects different) | |
| features = pd.DataFrame([[age, weight, height]], columns=["Age", "Weight", "Height"]) | |
| pred = model.predict(features)[0] | |
| st.success(f"Predicted Nutrition Status: **{pred}**") |