cheeka84 commited on
Commit
8e86d92
·
verified ·
1 Parent(s): 2f1c827

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -47,13 +47,10 @@ def predict_sales():
47
  input_data = pd.DataFrame([sample])
48
 
49
  # Make prediction (get log_sales)
50
- predicted_price = model.predict(input_data)[0]
51
 
52
- # Calculate actual sales
53
- # predicted_sales = np.exp(predicted_log_price)
54
-
55
- # Convert predicted_sales to Python float
56
- predicted_sales = 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
 
 
47
  input_data = pd.DataFrame([sample])
48
 
49
  # Make prediction (get log_sales)
50
+ predictions = model.predict(input_data)[0]
51
 
52
+ # Round predictions
53
+ predicted_sales = [round(float(x), 2) for x in predictions]
 
 
 
54
  # 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.
55
  # When we send this value directly within a JSON response, Flask's jsonify function encounters a datatype error
56