jarpan03 commited on
Commit
b0188ae
·
verified ·
1 Parent(s): ba254b1

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -47,17 +47,18 @@ def predict_product_batch():
47
  file = request.files['file']
48
 
49
  # Read the file into a DataFrame
50
- input_data = pd.read_csv(file)
 
51
  input_data = input_data.drop(['Product_Id','Store_Establishment_Year','Product_Allocated_Area'],axis=1)
52
 
53
  # Make predictions for the batch data
54
  predictions = model.predict(input_data).tolist()
55
 
56
  # Add predictions to the DataFrame
57
- input_data['Predicted_Product_Sales'] = predictions
58
 
59
  # Convert results to dictionary
60
- result = input_data.to_dict(orient="records")
61
 
62
  return jsonify(result)
63
 
 
47
  file = request.files['file']
48
 
49
  # Read the file into a DataFrame
50
+ data = pd.read_csv(file)
51
+ input_data = data.copy()
52
  input_data = input_data.drop(['Product_Id','Store_Establishment_Year','Product_Allocated_Area'],axis=1)
53
 
54
  # Make predictions for the batch data
55
  predictions = model.predict(input_data).tolist()
56
 
57
  # Add predictions to the DataFrame
58
+ data['Predicted_Product_Sales'] = predictions
59
 
60
  # Convert results to dictionary
61
+ result = data.to_dict(orient="records")
62
 
63
  return jsonify(result)
64