Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -47,9 +47,9 @@ def predict_store_total_sales():
|
|
| 47 |
# Convert the extracted data into a Pandas DataFrame
|
| 48 |
input_data = pd.DataFrame([sample])
|
| 49 |
|
| 50 |
-
st.write("Converted Json:", input_data.to_dict(orient='records')[0])
|
| 51 |
# Make prediction (get log_sales)
|
| 52 |
-
predicted_log_total_sales = model.predict(input_data)[0]
|
| 53 |
|
| 54 |
# Calculate actual price
|
| 55 |
#predicted_total_sales = np.exp(predicted_log_total_sales)
|
|
@@ -57,7 +57,7 @@ def predict_store_total_sales():
|
|
| 57 |
predicted_total_sales = predicted_log_total_sales
|
| 58 |
|
| 59 |
# Convert predicted_price to Python float
|
| 60 |
-
predicted_total_sales = round(float(predicted_total_sales), 2)
|
| 61 |
# The conversion above is needed as we convert the model prediction (log total sales) to actual sales using np.exp, which returns predictions as NumPy float32 values.
|
| 62 |
# When we send this value directly within a JSON response, Flask's jsonify function encounters a datatype error
|
| 63 |
|
|
|
|
| 47 |
# Convert the extracted data into a Pandas DataFrame
|
| 48 |
input_data = pd.DataFrame([sample])
|
| 49 |
|
| 50 |
+
#st.write("Converted Json:", input_data.to_dict(orient='records')[0])
|
| 51 |
# Make prediction (get log_sales)
|
| 52 |
+
predicted_log_total_sales = model.predict(input_data).tolist()[0]
|
| 53 |
|
| 54 |
# Calculate actual price
|
| 55 |
#predicted_total_sales = np.exp(predicted_log_total_sales)
|
|
|
|
| 57 |
predicted_total_sales = predicted_log_total_sales
|
| 58 |
|
| 59 |
# Convert predicted_price to Python float
|
| 60 |
+
#predicted_total_sales = round(float(predicted_total_sales), 2)
|
| 61 |
# The conversion above is needed as we convert the model prediction (log total sales) to actual sales using np.exp, which returns predictions as NumPy float32 values.
|
| 62 |
# When we send this value directly within a JSON response, Flask's jsonify function encounters a datatype error
|
| 63 |
|