Upload folder using huggingface_hub
Browse files
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)
|
|
|
|
|
|
|
| 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})
|