File size: 654 Bytes
0f1c816
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import streamlit as st
import numpy as np
import pickle

# Load the model
with open('log_reg_model.pkl', 'rb') as f:
    model = pickle.load(f)

st.title("AI Sleep State Detection")
st.markdown("Enter **angle** and **enmo** to predict the sleep state:")

angle = st.number_input("Angle", min_value=0.0, max_value=360.0, step=0.1)
enmo = st.number_input("ENMO", min_value=0.0, max_value=2.0, step=0.01)

if st.button("Detect Sleep State"):
    input_data = np.array([[angle, enmo]])
    prediction = model.predict(input_data)[0]

    if prediction == 0:
        st.success("Sleep State: **Wakeup**")
    else:
        st.success("Sleep State: **Onset**")