Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
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 |
-
|
52 |
-
|
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 = {
|