File size: 659 Bytes
0f1c816
b96d903
0f1c816
 
b96d903
 
0f1c816
b96d903
 
 
0f1c816
b96d903
 
0ae1060
0f1c816
b96d903
 
 
0f1c816
0ae1060
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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"