Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -65,14 +65,17 @@ def predict_sales_forecast_batch():
|
|
| 65 |
|
| 66 |
# Read the CSV file into a Pandas DataFrame
|
| 67 |
input_data = pd.read_csv(file)
|
| 68 |
-
print(input_data.loc[0])
|
| 69 |
|
| 70 |
-
# Make predictions for all
|
| 71 |
predicted_sales = model.predict(input_data).tolist()
|
| 72 |
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
| 74 |
# Create a dictionary of predictions with property IDs as keys
|
| 75 |
-
product_ids = input_data['Product_Id'].tolist() # Assuming 'Product_Id' is the
|
| 76 |
output_dict = dict(zip(product_ids, predicted_sales)) # Use actual prices
|
| 77 |
|
| 78 |
# Return the predictions dictionary as a JSON response
|
|
|
|
| 65 |
|
| 66 |
# Read the CSV file into a Pandas DataFrame
|
| 67 |
input_data = pd.read_csv(file)
|
| 68 |
+
#print(input_data.loc[0])
|
| 69 |
|
| 70 |
+
# Make predictions for all products in the DataFrame (get sales prices)
|
| 71 |
predicted_sales = model.predict(input_data).tolist()
|
| 72 |
|
| 73 |
+
# Convert predicted_price to Python float
|
| 74 |
+
predicted_sales = [round(float(price), 2) for price in predicted_sales]
|
| 75 |
+
|
| 76 |
+
#print(predicted_sales)
|
| 77 |
# Create a dictionary of predictions with property IDs as keys
|
| 78 |
+
product_ids = input_data['Product_Id'].tolist() # Assuming 'Product_Id' is the product_id ID column
|
| 79 |
output_dict = dict(zip(product_ids, predicted_sales)) # Use actual prices
|
| 80 |
|
| 81 |
# Return the predictions dictionary as a JSON response
|