pragmat commited on
Commit
7137e64
·
verified ·
1 Parent(s): fb8d41b

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +1 -21
app.py CHANGED
@@ -29,6 +29,7 @@ def predict_revenue():
29
  'Product_MRP': product_store_data['Product_MRP'],
30
  'Store_Id': product_store_data['Store_Id'],
31
  'Store_Establishment_Year': product_store_data['Store_Establishment_Year'],
 
32
  'Store_Location_City_Type': product_store_data['Store_Location_City_Type'],
33
  'Store_Type': product_store_data['Store_Type']
34
  }
@@ -44,26 +45,5 @@ def predict_revenue():
44
  except Exception as e:
45
  return jsonify({"error": str(e)}), 500
46
 
47
-
48
- # -------- Batch prediction ----------
49
- @sales_revenue_predictor_api.post('/v1/revenuebatch')
50
- def predict_revenue_batch():
51
- try:
52
- file = request.files['file']
53
- input_data = pd.read_csv(file)
54
-
55
- predicted_logs = model.predict(input_data).tolist()
56
- predicted_revenues = [round(float(np.exp(log)), 2) for log in predicted_logs]
57
-
58
- # Fix: create proper IDs
59
- ids = (input_data['Product_Id'].astype(str) + "_" + input_data['Store_Id'].astype(str)).tolist()
60
- output_dict = dict(zip(ids, predicted_revenues))
61
-
62
- return jsonify(output_dict)
63
-
64
- except Exception as e:
65
- return jsonify({"error": str(e)}), 500
66
-
67
-
68
  if __name__ == '__main__':
69
  sales_revenue_predictor_api.run(host="0.0.0.0", port=8000, debug=True)
 
29
  'Product_MRP': product_store_data['Product_MRP'],
30
  'Store_Id': product_store_data['Store_Id'],
31
  'Store_Establishment_Year': product_store_data['Store_Establishment_Year'],
32
+ 'Store_Size': product_store_data['Store_Size'],
33
  'Store_Location_City_Type': product_store_data['Store_Location_City_Type'],
34
  'Store_Type': product_store_data['Store_Type']
35
  }
 
45
  except Exception as e:
46
  return jsonify({"error": str(e)}), 500
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  if __name__ == '__main__':
49
  sales_revenue_predictor_api.run(host="0.0.0.0", port=8000, debug=True)