Spaces:
Runtime error
Runtime error
modifying names of keys for sample and scheduler to start with lowercase exactly as the names in the columns in the DataFrame
Browse files
app.py
CHANGED
|
@@ -57,12 +57,12 @@ scheduler = CommitScheduler(
|
|
| 57 |
#-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| 58 |
def predict_insurance_charge(age, bmi, children, sex, smoker, region):
|
| 59 |
sample = {
|
| 60 |
-
'
|
| 61 |
-
'
|
| 62 |
-
'
|
| 63 |
-
'
|
| 64 |
-
'
|
| 65 |
-
'
|
| 66 |
}
|
| 67 |
data_point = pd.DataFrame([sample])
|
| 68 |
prediction = insurance_charge_predictor.predict(data_point).tolist() # use the model_ic.joblib retrieved above to make the prediction
|
|
@@ -75,12 +75,12 @@ def predict_insurance_charge(age, bmi, children, sex, smoker, region):
|
|
| 75 |
with log_file.open("a") as f:
|
| 76 |
f.write(json.dumps(
|
| 77 |
{
|
| 78 |
-
'
|
| 79 |
-
'
|
| 80 |
-
'
|
| 81 |
-
'
|
| 82 |
-
'
|
| 83 |
-
'
|
| 84 |
'prediction': prediction[0]
|
| 85 |
}
|
| 86 |
))
|
|
|
|
| 57 |
#-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| 58 |
def predict_insurance_charge(age, bmi, children, sex, smoker, region):
|
| 59 |
sample = {
|
| 60 |
+
'age': age,
|
| 61 |
+
'bmi': bmi,
|
| 62 |
+
'children': children,
|
| 63 |
+
'sex': sex,
|
| 64 |
+
'smoker': smoker,
|
| 65 |
+
'region': region
|
| 66 |
}
|
| 67 |
data_point = pd.DataFrame([sample])
|
| 68 |
prediction = insurance_charge_predictor.predict(data_point).tolist() # use the model_ic.joblib retrieved above to make the prediction
|
|
|
|
| 75 |
with log_file.open("a") as f:
|
| 76 |
f.write(json.dumps(
|
| 77 |
{
|
| 78 |
+
'age': age,
|
| 79 |
+
'bmi': bmi,
|
| 80 |
+
'children': children,
|
| 81 |
+
'sex': sex,
|
| 82 |
+
'smoker': smoker,
|
| 83 |
+
'region': region,
|
| 84 |
'prediction': prediction[0]
|
| 85 |
}
|
| 86 |
))
|