Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
pickle.dump(var, f)
|
| 8 |
-
|
| 9 |
-
# disassemble the pickle
|
| 10 |
-
# and print the instructions to the command line
|
| 11 |
-
with open('log_reg_model.pkl', 'rb') as f:
|
| 12 |
-
pickletools.dis(f)
|
| 13 |
|
| 14 |
# Define prediction function
|
| 15 |
def predict_sleep(step: float, hour: float):
|
|
@@ -23,7 +17,7 @@ iface = gr.Interface(
|
|
| 23 |
fn=predict_sleep,
|
| 24 |
inputs=[
|
| 25 |
gr.Number(label="Step Count"),
|
| 26 |
-
gr.Number(label="Hour (0
|
| 27 |
],
|
| 28 |
outputs=gr.Text(label="Prediction"),
|
| 29 |
title="Sleep Prediction (Onset/Wakeup)",
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import joblib
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
+
# Load the model using joblib
|
| 6 |
+
model = joblib.load("log_reg_model.pkl")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Define prediction function
|
| 9 |
def predict_sleep(step: float, hour: float):
|
|
|
|
| 17 |
fn=predict_sleep,
|
| 18 |
inputs=[
|
| 19 |
gr.Number(label="Step Count"),
|
| 20 |
+
gr.Number(label="Hour (0–23)")
|
| 21 |
],
|
| 22 |
outputs=gr.Text(label="Prediction"),
|
| 23 |
title="Sleep Prediction (Onset/Wakeup)",
|