kgauvin603 commited on
Commit
5f66429
·
verified ·
1 Parent(s): 4697b71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -39,17 +39,18 @@ def predict(age, bmi, children, sex, smoker, region):
39
  'sex': sex,
40
  'smoker': smoker,
41
  'region': region}
42
-
43
- df = pd.DataFrame(data)
44
- print("Input DataFrame:", df)
 
45
 
46
  # Apply the same transformations used in training
47
- transformed_df = model.named_steps['columntransformer'].transform(df)
48
- print("Transformed DataFrame:", transformed_df) # Debug transformed data
49
 
50
  # Predict using the trained model
51
- prediction = model.predict(df)[0]
52
- prediction = float(prediction)
53
 
54
  # Prepare the log entry
55
  log_entry = {
 
39
  'sex': sex,
40
  'smoker': smoker,
41
  'region': region}
42
+
43
+ df = pd.DataFrame(data, index=[0])
44
+ prediction = model.predict(df)[0]
45
+ prediction = float(prediction)
46
 
47
  # Apply the same transformations used in training
48
+ #transformed_df = model.named_steps['columntransformer'].transform(df)
49
+ #print("Transformed DataFrame:", transformed_df) # Debug transformed data
50
 
51
  # Predict using the trained model
52
+ #p rediction = model.predict(df)[0]
53
+
54
 
55
  # Prepare the log entry
56
  log_entry = {