Update app.py
Browse files
app.py
CHANGED
|
@@ -39,13 +39,13 @@ model_output = gr.Label(label='Charges')
|
|
| 39 |
# the functions runs when 'Submit' is clicked or when a API request is made
|
| 40 |
def predict_charges(age, bmi, children, sex, smoker, region, prediction):
|
| 41 |
sample = {
|
| 42 |
-
'
|
| 43 |
-
'
|
| 44 |
-
'
|
| 45 |
-
'
|
| 46 |
-
'
|
| 47 |
-
'
|
| 48 |
-
'
|
| 49 |
}
|
| 50 |
data_point = pd.DataFrame([sample])
|
| 51 |
print('data point: ', data_point)
|
|
@@ -56,13 +56,13 @@ def predict_charges(age, bmi, children, sex, smoker, region, prediction):
|
|
| 56 |
with log_file.open("a") as f:
|
| 57 |
f.write(json.dumps(
|
| 58 |
{
|
| 59 |
-
'
|
| 60 |
-
'
|
| 61 |
-
'
|
| 62 |
-
'
|
| 63 |
-
'
|
| 64 |
-
'
|
| 65 |
-
'
|
| 66 |
}
|
| 67 |
))
|
| 68 |
f.write("\n")
|
|
|
|
| 39 |
# the functions runs when 'Submit' is clicked or when a API request is made
|
| 40 |
def predict_charges(age, bmi, children, sex, smoker, region, prediction):
|
| 41 |
sample = {
|
| 42 |
+
'age': age,
|
| 43 |
+
'bmi': bmi,
|
| 44 |
+
'children': children,
|
| 45 |
+
'sex': sex,
|
| 46 |
+
'smoker': smoker,
|
| 47 |
+
'region': region,
|
| 48 |
+
'prediction': prediction
|
| 49 |
}
|
| 50 |
data_point = pd.DataFrame([sample])
|
| 51 |
print('data point: ', data_point)
|
|
|
|
| 56 |
with log_file.open("a") as f:
|
| 57 |
f.write(json.dumps(
|
| 58 |
{
|
| 59 |
+
'age': age,
|
| 60 |
+
'bmi': bmi,
|
| 61 |
+
'children': children,
|
| 62 |
+
'sex': sex,
|
| 63 |
+
'smoker': smoker,
|
| 64 |
+
'region': region,
|
| 65 |
+
'prediction': prediction[0]
|
| 66 |
}
|
| 67 |
))
|
| 68 |
f.write("\n")
|