Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import pickle
|
4 |
+
|
5 |
+
# Load the model
|
6 |
+
with open('log_reg_model.pkl', 'rb') as f:
|
7 |
+
model = pickle.load(f)
|
8 |
+
|
9 |
+
st.title("AI Sleep State Detection")
|
10 |
+
st.markdown("Enter **angle** and **enmo** to predict the sleep state:")
|
11 |
+
|
12 |
+
angle = st.number_input("Angle", min_value=0.0, max_value=360.0, step=0.1)
|
13 |
+
enmo = st.number_input("ENMO", min_value=0.0, max_value=2.0, step=0.01)
|
14 |
+
|
15 |
+
if st.button("Detect Sleep State"):
|
16 |
+
input_data = np.array([[angle, enmo]])
|
17 |
+
prediction = model.predict(input_data)[0]
|
18 |
+
|
19 |
+
if prediction == 0:
|
20 |
+
st.success("Sleep State: **Wakeup**")
|
21 |
+
else:
|
22 |
+
st.success("Sleep State: **Onset**")
|