Upload folder using huggingface_hub
Browse files- SuperKart_Sales_prediction_model_v1_0.joblib +2 -2
- app.py +3 -5
SuperKart_Sales_prediction_model_v1_0.joblib
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7dd5f2e0b529409e7f8893fcac69d00a5918e13c60210043b39644ef1a7482e8
|
| 3 |
+
size 194909
|
app.py
CHANGED
|
@@ -20,6 +20,7 @@ def home():
|
|
| 20 |
The function displays simple welcome message.
|
| 21 |
"""
|
| 22 |
|
|
|
|
| 23 |
handler = logging.FileHandler('app.log')
|
| 24 |
product_sales_predictor_api.logger.addHandler(handler)
|
| 25 |
product_sales_predictor_api.logger.setLevel(logging.INFO)
|
|
@@ -36,6 +37,8 @@ def predict_Product_Sales():
|
|
| 36 |
the predicted sales price as a JSON response.
|
| 37 |
"""
|
| 38 |
|
|
|
|
|
|
|
| 39 |
product_sales_predictor_api.logger.info('single prediction entered')
|
| 40 |
|
| 41 |
print(">>> product endpoint invoked!", flush=True)
|
|
@@ -60,11 +63,6 @@ def predict_Product_Sales():
|
|
| 60 |
# Make prediction (get log_price)
|
| 61 |
predicted_sales = model.predict(input_data)[0]
|
| 62 |
|
| 63 |
-
# Convert predicted_price to Python float
|
| 64 |
-
# predicted_sales = round(float(predicted_sales), 2)
|
| 65 |
-
# 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.
|
| 66 |
-
# When we send this value directly within a JSON response, Flask's jsonify function encounters a datatype error
|
| 67 |
-
|
| 68 |
# Return the actual Predicted sales price
|
| 69 |
return jsonify({'Predicted Sales': predicted_sales})
|
| 70 |
|
|
|
|
| 20 |
The function displays simple welcome message.
|
| 21 |
"""
|
| 22 |
|
| 23 |
+
# message added as part of debugging process to check the function was getting invoked
|
| 24 |
handler = logging.FileHandler('app.log')
|
| 25 |
product_sales_predictor_api.logger.addHandler(handler)
|
| 26 |
product_sales_predictor_api.logger.setLevel(logging.INFO)
|
|
|
|
| 37 |
the predicted sales price as a JSON response.
|
| 38 |
"""
|
| 39 |
|
| 40 |
+
#All types of logging enabled when issue was faced in endpoint access.
|
| 41 |
+
#code retained as it is after debugging
|
| 42 |
product_sales_predictor_api.logger.info('single prediction entered')
|
| 43 |
|
| 44 |
print(">>> product endpoint invoked!", flush=True)
|
|
|
|
| 63 |
# Make prediction (get log_price)
|
| 64 |
predicted_sales = model.predict(input_data)[0]
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
# Return the actual Predicted sales price
|
| 67 |
return jsonify({'Predicted Sales': predicted_sales})
|
| 68 |
|