Gowthamvemula commited on
Commit
de96aa5
·
verified ·
1 Parent(s): 469be50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -1,15 +1,9 @@
1
  import gradio as gr
2
- import pickle
3
  import numpy as np
4
 
5
- # store the pickle data in a file named 'payload.pkl'
6
- with open('log_reg_model.pkl', 'wb') as f:
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-23)")
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 (023)")
21
  ],
22
  outputs=gr.Text(label="Prediction"),
23
  title="Sleep Prediction (Onset/Wakeup)",