Thiresh commited on
Commit
71d67fd
·
verified ·
1 Parent(s): a323576

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -53,7 +53,9 @@ def predict_rental_price():
53
  predicted_price = np.exp(predicted_log_price)
54
 
55
  # Convert predicted_price to Python float
56
- predicted_price = round(float(predicted_price), 2) # NOTE: Our model (XGBoost) probably returns predictions as NumPy float32 values for efficiency. When you attempt to send these predictions directly within a JSON response, Flask's jsonify function encounters a datatype error
 
 
57
 
58
  # Return the actual price
59
  return jsonify({'Predicted Price (in dollars)': predicted_price})
 
53
  predicted_price = np.exp(predicted_log_price)
54
 
55
  # Convert predicted_price to Python float
56
+ predicted_price = round(float(predicted_price), 2)
57
+ # The conversion above is needed as we convert the model prediction (log price) to actual price using np.exp, which returns predictions as NumPy float32 values.
58
+ # When we send this value directly within a JSON response, Flask's jsonify function encounters a datatype error
59
 
60
  # Return the actual price
61
  return jsonify({'Predicted Price (in dollars)': predicted_price})