Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -76,6 +76,10 @@ def sales_price_batch():
|
|
| 76 |
input_data = pd.read_csv(file)
|
| 77 |
input_data['Store_Age'] = 2025 - input_data['Store_Establishment_Year']
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
# Apply same transformations
|
| 80 |
input_transformed = preprocessor.transform(input_data)
|
| 81 |
|
|
@@ -86,8 +90,6 @@ def sales_price_batch():
|
|
| 86 |
predicted_sales = round(float(predicted_sales), 2)
|
| 87 |
|
| 88 |
# Create a dictionary of predictions with property IDs as keys
|
| 89 |
-
product_ids = input_data['Product_Id'].tolist() # Assuming 'Id' is the product ID column
|
| 90 |
-
store_ids = input_data['Store_Id'].tolist() # Assuming 'Id' is the store ID column
|
| 91 |
output_dict = dict(zip(product_ids, store_ids, predicted_sales)) # Use actual prices
|
| 92 |
|
| 93 |
# Return the predictions dictionary as a JSON response
|
|
|
|
| 76 |
input_data = pd.read_csv(file)
|
| 77 |
input_data['Store_Age'] = 2025 - input_data['Store_Establishment_Year']
|
| 78 |
|
| 79 |
+
product_ids = input_data['Product_Id'].tolist() # Assuming 'Id' is the product ID column
|
| 80 |
+
store_ids = input_data['Store_Id'].tolist() # Assuming 'Id' is the store ID column
|
| 81 |
+
input_data = input_data.drop(['Product_Id', 'Store_Id', 'Store_Establishment_Year'], axis=1)
|
| 82 |
+
|
| 83 |
# Apply same transformations
|
| 84 |
input_transformed = preprocessor.transform(input_data)
|
| 85 |
|
|
|
|
| 90 |
predicted_sales = round(float(predicted_sales), 2)
|
| 91 |
|
| 92 |
# Create a dictionary of predictions with property IDs as keys
|
|
|
|
|
|
|
| 93 |
output_dict = dict(zip(product_ids, store_ids, predicted_sales)) # Use actual prices
|
| 94 |
|
| 95 |
# Return the predictions dictionary as a JSON response
|