TokenTutor commited on
Commit
4767f39
·
verified ·
1 Parent(s): 9d3b4f4

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +7 -4
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 properties in the DataFrame (get log_prices)
71
  predicted_sales = model.predict(input_data).tolist()
72
 
73
- print(predicted_sales)
 
 
 
74
  # Create a dictionary of predictions with property IDs as keys
75
- product_ids = input_data['Product_Id'].tolist() # Assuming 'Product_Id' is the property ID column
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