Hugo014 commited on
Commit
af2151f
·
verified ·
1 Parent(s): d2b2b38

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -9,7 +9,7 @@ super_kart_api = Flask("Super Kart Price Predictor")
9
  # Load the trained machine learning model
10
  model = joblib.load("backend_files/super_kart_model_v1_0.joblib")
11
 
12
- # Expected feature names from training (copy these from your training code or model inspection)
13
  EXPECTED_COLUMNS = [
14
  'Product_Type_Baking Goods', 'Product_Type_Breads', 'Product_Type_Breakfast', 'Product_Type_Canned',
15
  'Product_Type_Dairy', 'Product_Type_Frozen Foods', 'Product_Type_Fruits and Vegetables',
@@ -57,7 +57,7 @@ def predict_sales():
57
  features_df['Store_Size'] = features_df['Store_Size'].map(size_mapping)
58
  features_df['Store_Location_City_Type'] = features_df['Store_Location_City_Type'].map(city_mapping)
59
 
60
- # Align columns with expected model features (add missing with 0, drop extras)
61
  features_df = features_df.reindex(columns=EXPECTED_COLUMNS, fill_value=0)
62
 
63
  # Make prediction
 
9
  # Load the trained machine learning model
10
  model = joblib.load("backend_files/super_kart_model_v1_0.joblib")
11
 
12
+ # Expected feature names from the model (adjust if your training columns differ)
13
  EXPECTED_COLUMNS = [
14
  'Product_Type_Baking Goods', 'Product_Type_Breads', 'Product_Type_Breakfast', 'Product_Type_Canned',
15
  'Product_Type_Dairy', 'Product_Type_Frozen Foods', 'Product_Type_Fruits and Vegetables',
 
57
  features_df['Store_Size'] = features_df['Store_Size'].map(size_mapping)
58
  features_df['Store_Location_City_Type'] = features_df['Store_Location_City_Type'].map(city_mapping)
59
 
60
+ # Align with expected columns (add missing as 0, drop extras)
61
  features_df = features_df.reindex(columns=EXPECTED_COLUMNS, fill_value=0)
62
 
63
  # Make prediction