cheeka84 commited on
Commit
662b7d8
·
verified ·
1 Parent(s): 98ee3cf

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -40,14 +40,15 @@ def predict_sales():
40
  'Store_Size': sales_data['Store_Size'],
41
  'Store_Location_City_Type': sales_data['Store_Location_City_Type'],
42
  'Store_Type': sales_data['Store_Type'],
43
- 'Store_Age': sales_data['Store_Age']
 
44
  }
45
 
46
  # Convert the extracted data into a Pandas DataFrame
47
  input_data = pd.DataFrame([sample])
48
 
49
  # Make prediction (get log_sales)
50
- predictions = np.log(model.predict(input_data)[0])
51
 
52
  # Round predictions
53
  predicted_sales = round(float(predictions), 2)
@@ -79,13 +80,13 @@ def sales_price_batch():
79
  store_ids = input_data_batch['Store_Id'].tolist()
80
 
81
  # Drop unused columns
82
- input_data_batch = input_data_batch.drop(['Product_Id', 'Store_Id', 'Store_Establishment_Year'], axis=1)
83
 
84
  # Apply preprocessing if needed
85
  # input_data_transformed = preprocessor.transform(input_data_batch)
86
  # predictions = model.predict(input_data_transformed)
87
 
88
- predictions = np.log(model.predict(input_data_batch)) # Assuming already preprocessed or numeric
89
 
90
  # Round predictions
91
  predicted_sales = [round(float(x), 2) for x in predictions]
 
40
  'Store_Size': sales_data['Store_Size'],
41
  'Store_Location_City_Type': sales_data['Store_Location_City_Type'],
42
  'Store_Type': sales_data['Store_Type'],
43
+ 'Store_Age': sales_data['Store_Age'],
44
+ 'Store_id': sales_data['Store_id']
45
  }
46
 
47
  # Convert the extracted data into a Pandas DataFrame
48
  input_data = pd.DataFrame([sample])
49
 
50
  # Make prediction (get log_sales)
51
+ predictions = np.exp(model.predict(input_data)[0])
52
 
53
  # Round predictions
54
  predicted_sales = round(float(predictions), 2)
 
80
  store_ids = input_data_batch['Store_Id'].tolist()
81
 
82
  # Drop unused columns
83
+ input_data_batch = input_data_batch.drop(['Product_Id', 'Store_Establishment_Year'], axis=1)
84
 
85
  # Apply preprocessing if needed
86
  # input_data_transformed = preprocessor.transform(input_data_batch)
87
  # predictions = model.predict(input_data_transformed)
88
 
89
+ predictions = np.exp(model.predict(input_data_batch)) # Assuming already preprocessed or numeric
90
 
91
  # Round predictions
92
  predicted_sales = [round(float(x), 2) for x in predictions]