Georgek17 commited on
Commit
8e9e80e
·
verified ·
1 Parent(s): 2c6acfe

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -14,7 +14,7 @@ def home():
14
  return "Welcome to the Sales Revenue Prediction API!"
15
 
16
  # Define an endpoint to predict churn for a single customer
17
- @SalesRevenue_predictor_api.post('/')
18
  def predict_revenue():
19
  # Get JSON data from the request
20
  product_data = request.get_json()
@@ -36,16 +36,16 @@ def predict_revenue():
36
  # Convert the extracted data into a DataFrame
37
  input_data = pd.DataFrame([sample])
38
 
39
- # Make a churn prediction using the trained model
40
  prediction = model.predict(input_data).tolist()[0]
41
 
42
  # Map prediction result to a human-readable label
43
  # prediction_label = "churn" if prediction == 1 else "not churn"
44
 
45
  # Return the prediction as a JSON response
46
- return jsonify({'Prediction': prediction}),"Prediction completed"
47
 
48
 
49
  # Run the Flask app in debug mode
50
  if __name__ == '__main__':
51
- app.run(debug=True)
 
14
  return "Welcome to the Sales Revenue Prediction API!"
15
 
16
  # Define an endpoint to predict churn for a single customer
17
+ @SalesRevenue_predictor_api.post('/Sales_prediction')
18
  def predict_revenue():
19
  # Get JSON data from the request
20
  product_data = request.get_json()
 
36
  # Convert the extracted data into a DataFrame
37
  input_data = pd.DataFrame([sample])
38
 
39
+ # Make a revenue prediction using the trained model
40
  prediction = model.predict(input_data).tolist()[0]
41
 
42
  # Map prediction result to a human-readable label
43
  # prediction_label = "churn" if prediction == 1 else "not churn"
44
 
45
  # Return the prediction as a JSON response
46
+ return jsonify({ 'Prediction': prediction, 'Message': 'Prediction completed' })
47
 
48
 
49
  # Run the Flask app in debug mode
50
  if __name__ == '__main__':
51
+ SalesRevenue_predictor_api.run(debug=True)