Spaces:
Runtime error
Runtime error
Debugging value error in prediction datatype
Browse files
app.py
CHANGED
|
@@ -22,9 +22,9 @@ from pathlib import Path
|
|
| 22 |
# Run the training script placed in the same directory as app.py
|
| 23 |
# The training script will train and persist a linear regression
|
| 24 |
# model with the filename 'model_ic.joblib'
|
| 25 |
-
print("... Initializing train_ic.py")
|
| 26 |
os.system('python train_ic.py') # Take a command line argument: execute the "train_ic.py" in a subterminal... this will load the data file and serialize the model into "model_ic.joblib
|
| 27 |
-
print("... train_ic.py initialized
|
| 28 |
|
| 29 |
# Load the freshly trained model from disk
|
| 30 |
# Reconstruct a Python object from a file persisted with joblib.dump.
|
|
@@ -86,7 +86,11 @@ def predict_insurance_charge(age, bmi, children, sex, smoker, region):
|
|
| 86 |
))
|
| 87 |
f.write("\n")
|
| 88 |
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| 91 |
|
| 92 |
# Set up UI components for input and output
|
|
|
|
| 22 |
# Run the training script placed in the same directory as app.py
|
| 23 |
# The training script will train and persist a linear regression
|
| 24 |
# model with the filename 'model_ic.joblib'
|
| 25 |
+
print(f"\n... Initializing train_ic.py\n")
|
| 26 |
os.system('python train_ic.py') # Take a command line argument: execute the "train_ic.py" in a subterminal... this will load the data file and serialize the model into "model_ic.joblib
|
| 27 |
+
print(f"\n... train_ic.py initialized.\n")
|
| 28 |
|
| 29 |
# Load the freshly trained model from disk
|
| 30 |
# Reconstruct a Python object from a file persisted with joblib.dump.
|
|
|
|
| 86 |
))
|
| 87 |
f.write("\n")
|
| 88 |
|
| 89 |
+
prediction_result = prediction[0]
|
| 90 |
+
print(f"\nDebug - Prediction result: {prediction_result} - {type(prediction_result)}\n")
|
| 91 |
+
return prediction_result
|
| 92 |
+
|
| 93 |
+
#return prediction[0]
|
| 94 |
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| 95 |
|
| 96 |
# Set up UI components for input and output
|