Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -10,9 +10,11 @@ model = joblib.load("deployment_files/superkart_sales_forecast_model_v1_0.joblib
|
|
| 10 |
def home():
|
| 11 |
return "SuperKart Sales Forecasting API is alive"
|
| 12 |
|
| 13 |
-
|
|
|
|
| 14 |
def predict_sales():
|
| 15 |
data = request.get_json()
|
|
|
|
| 16 |
sample = {
|
| 17 |
"Product_Weight": data["Product_Weight"],
|
| 18 |
"Product_Sugar_Content": data["Product_Sugar_Content"],
|
|
@@ -21,7 +23,6 @@ def predict_sales():
|
|
| 21 |
"Store_Size": data["Store_Size"],
|
| 22 |
"Store_Location_City_Type": data["Store_Location_City_Type"],
|
| 23 |
"Store_Type": data["Store_Type"],
|
| 24 |
-
"Product_Id": data["Product_Id"],
|
| 25 |
"Store_Establishment_Year": data["Store_Establishment_Year"],
|
| 26 |
"Product_Type": data["Product_Type"],
|
| 27 |
}
|
|
@@ -30,4 +31,3 @@ def predict_sales():
|
|
| 30 |
|
| 31 |
if __name__ == "__main__":
|
| 32 |
superkart_sales_api.run(debug=True)
|
| 33 |
-
|
|
|
|
| 10 |
def home():
|
| 11 |
return "SuperKart Sales Forecasting API is alive"
|
| 12 |
|
| 13 |
+
# Corrected API endpoint to match the frontend call
|
| 14 |
+
@superkart_sales_api.post("/v1/sales")
|
| 15 |
def predict_sales():
|
| 16 |
data = request.get_json()
|
| 17 |
+
# Updated sample to match exactly what the model pipeline expects
|
| 18 |
sample = {
|
| 19 |
"Product_Weight": data["Product_Weight"],
|
| 20 |
"Product_Sugar_Content": data["Product_Sugar_Content"],
|
|
|
|
| 23 |
"Store_Size": data["Store_Size"],
|
| 24 |
"Store_Location_City_Type": data["Store_Location_City_Type"],
|
| 25 |
"Store_Type": data["Store_Type"],
|
|
|
|
| 26 |
"Store_Establishment_Year": data["Store_Establishment_Year"],
|
| 27 |
"Product_Type": data["Product_Type"],
|
| 28 |
}
|
|
|
|
| 31 |
|
| 32 |
if __name__ == "__main__":
|
| 33 |
superkart_sales_api.run(debug=True)
|
|
|