anithajk commited on
Commit
053337f
·
verified ·
1 Parent(s): 042cdbf

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -45,12 +45,12 @@ def predict_product_sales():
45
  # Convert the extracted data into a Pandas DataFrame
46
  input_data = pd.DataFrame([sample])
47
 
48
- # Make prediction (get log_price)
49
- predicted_log_price = model.predict(input_data)[0]
50
- print(f"Predicted log price: {predicted_log_price}")
51
 
52
  # Calculate actual price
53
- predicted_price = np.exp(predicted_log_price)
54
 
55
  # Convert predicted_price to Python float
56
  predicted_price = round(float(predicted_price), 2)
@@ -77,10 +77,10 @@ def predict_product_sale_price_batch():
77
  input_data = pd.read_csv(file)
78
 
79
  # Make predictions for all product sale in the stores in the DataFrame (get log_prices)
80
- predicted_log_prices = model.predict(input_data).tolist()
81
 
82
  # Calculate actual prices
83
- predicted_prices = [round(float(np.exp(log_price)), 2) for log_price in predicted_log_prices]
84
 
85
  # Create a dictionary of predictions with product IDs as keys
86
  product_ids = input_data['id'].tolist() # Assuming 'id' is the product ID column
 
45
  # Convert the extracted data into a Pandas DataFrame
46
  input_data = pd.DataFrame([sample])
47
 
48
+ # Make prediction (get Product_Store_Sales_Total)
49
+ predicted_Product_Store_Sales_Total = model.predict(input_data)[0]
50
+ print(f"Predicted Product_Store_Sales_Total: {predicted_Product_Store_Sales_Total}")
51
 
52
  # Calculate actual price
53
+ predicted_price = np.exp(predicted_Product_Store_Sales_Total)
54
 
55
  # Convert predicted_price to Python float
56
  predicted_price = round(float(predicted_price), 2)
 
77
  input_data = pd.read_csv(file)
78
 
79
  # Make predictions for all product sale in the stores in the DataFrame (get log_prices)
80
+ predicted_Product_Store_Sales_Total = model.predict(input_data).tolist()
81
 
82
  # Calculate actual prices
83
+ predicted_prices = [round(float(np.exp(total_sale_price)), 2) for total_sale_price in predicted_Product_Store_Sales_Total]
84
 
85
  # Create a dictionary of predictions with product IDs as keys
86
  product_ids = input_data['id'].tolist() # Assuming 'id' is the product ID column