Spaces:
Sleeping
Sleeping
import streamlit as st | |
import joblib | |
import numpy as np | |
# Load your model | |
model = joblib.load("log_reg_model.pkl") # or "log_reg_model.pkl" | |
# Streamlit App UI | |
st.title("AI Sleep State Detector") | |
st.write("Predict sleep state (`onset` or `wakeup`) using step count and hour.") | |
# Input Features | |
step = st.number_input("Step count:", min_value=0, max_value=10000, value=0) | |
hour = st.number_input("Hour of day (0–23):", min_value=0, max_value=23, value=0) | |
# Predict Button | |
if st.button("Predict Sleep State"): | |
input_data = np.array([[step, hour]]) | |
prediction = model.predict(input_data)[0] | |
return "Sleep Onset" if prediction == 1 else "Wakeup" | |