jialitan23 commited on
Commit
e700c79
·
verified ·
1 Parent(s): 213607d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -21,9 +21,9 @@ categorical_features = ['Movement Activity', 'Location', 'day_of_week']
21
  categories_map = {cat: encoder.categories_[i].tolist() for i, cat in enumerate(categorical_features)}
22
 
23
  # --- Prediction function ---
24
- def predict_fall(movement_activity, location, day_of_week, hour_of_day, minute_of_day, time_since_last_event):
25
  try:
26
- # Initialize all features to 0
27
  data = {f: 0 for f in feature_names}
28
 
29
  # Set one-hot encoded categorical features
@@ -32,8 +32,6 @@ def predict_fall(movement_activity, location, day_of_week, hour_of_day, minute_o
32
  data[f'day_of_week_{day_of_week}'] = 1
33
 
34
  # Set numeric features
35
- data['hour_of_day'] = hour_of_day
36
- data['minute_of_day'] = minute_of_day
37
  data['time_since_last_event'] = time_since_last_event
38
 
39
  # Create DataFrame with all features in correct order
 
21
  categories_map = {cat: encoder.categories_[i].tolist() for i, cat in enumerate(categorical_features)}
22
 
23
  # --- Prediction function ---
24
+ def predict_fall(movement_activity, location, day_of_week, time_since_last_event):
25
  try:
26
+ # Initialize all features to 0hour_of_day, minute_of_day,
27
  data = {f: 0 for f in feature_names}
28
 
29
  # Set one-hot encoded categorical features
 
32
  data[f'day_of_week_{day_of_week}'] = 1
33
 
34
  # Set numeric features
 
 
35
  data['time_since_last_event'] = time_since_last_event
36
 
37
  # Create DataFrame with all features in correct order