Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -56,14 +56,14 @@ def predict_sales_forecast_batch():
|
|
| 56 |
# Read the CSV file into a Pandas DataFrame
|
| 57 |
input_data = pd.read_csv(file)
|
| 58 |
|
| 59 |
-
# Make predictions for all
|
| 60 |
-
|
| 61 |
|
| 62 |
# Calculate actual prices
|
| 63 |
-
predicted_sales = [round(float(
|
| 64 |
|
| 65 |
-
# Create a dictionary of predictions with
|
| 66 |
-
product_ids = input_data['Product_ID'].tolist() # Assuming 'id' is the
|
| 67 |
output_dict = dict(zip(product_ids, predicted_sales)) # Use actual prices
|
| 68 |
|
| 69 |
# Return the predictions dictionary as a JSON response
|
|
|
|
| 56 |
# Read the CSV file into a Pandas DataFrame
|
| 57 |
input_data = pd.read_csv(file)
|
| 58 |
|
| 59 |
+
# Make predictions for all products in the DataFrame (get log_prices)
|
| 60 |
+
predicted_sales = model.predict(input_data).tolist()
|
| 61 |
|
| 62 |
# Calculate actual prices
|
| 63 |
+
predicted_sales = [round(float(Product_Store_Sales_Total, 2)) for Product_Store_Sales_Total in predicted_sales]
|
| 64 |
|
| 65 |
+
# Create a dictionary of predictions with Product IDs as keys
|
| 66 |
+
product_ids = input_data['Product_ID'].tolist() # Assuming 'id' is the Product ID column
|
| 67 |
output_dict = dict(zip(product_ids, predicted_sales)) # Use actual prices
|
| 68 |
|
| 69 |
# Return the predictions dictionary as a JSON response
|