praneeth232 commited on
Commit
697f879
·
verified ·
1 Parent(s): 33b14c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -14,7 +14,7 @@ def home():
14
  return "Welcome to the Customer Churn Prediction API!"
15
 
16
  # Define an endpoint to predict churn for a single customer
17
- @app.post('/v1/customer')
18
  def predict_churn():
19
  # Get JSON data from the request
20
  customer_data = request.get_json()
@@ -45,7 +45,7 @@ def predict_churn():
45
  return jsonify({'Churn expected?': prediction_label})
46
 
47
  # Define an endpoint to predict churn for a batch of customers
48
- @app.post('/v1/customerbatch')
49
  def predict_churn_batch():
50
  # Get the uploaded CSV file from the request
51
  file = request.files['file']
@@ -62,8 +62,4 @@ def predict_churn_batch():
62
  # Return the batch predictions as a JSON response
63
  #return jsonify({'predictions': predictions})
64
 
65
- return output_dict
66
-
67
- # Run the Flask app in debug mode
68
- if __name__ == '__main__':
69
- app.run(debug=True)
 
14
  return "Welcome to the Customer Churn Prediction API!"
15
 
16
  # Define an endpoint to predict churn for a single customer
17
+ @app.post('/customer')
18
  def predict_churn():
19
  # Get JSON data from the request
20
  customer_data = request.get_json()
 
45
  return jsonify({'Churn expected?': prediction_label})
46
 
47
  # Define an endpoint to predict churn for a batch of customers
48
+ @app.post('/customerbatch')
49
  def predict_churn_batch():
50
  # Get the uploaded CSV file from the request
51
  file = request.files['file']
 
62
  # Return the batch predictions as a JSON response
63
  #return jsonify({'predictions': predictions})
64
 
65
+ return output_dict