Spaces:
Running
Running
File size: 692 Bytes
0f1c816 a87a892 0f1c816 a87a892 a10cec3 0f1c816 a87a892 0f1c816 8e604c2 c49581e 0f1c816 a87a892 6eb7142 f3a7e8e a87a892 f3a7e8e a87a892 e91da0e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import streamlit as st
import numpy as np
import joblib # use joblib instead of pickle
# Load model with joblib
model = joblib.load("random_forest_model.pkl")
st.title("AI Sleep State Detection")
st.markdown("Enter **angle** and **enmo** to predict the sleep state:")
angle = st.number_input("Angle", min_value=-90.0, max_value=360.0, step=0.1)
enmo = st.number_input("ENMO", min_value=0.0, max_value=10.0, step=0.0001, format="%.4f")
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**")
|