arifshora commited on
Commit
e7d6bbd
·
verified ·
1 Parent(s): d8b19e5

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -66,32 +66,32 @@ def predict_churn_batch():
66
 
67
  return output_dict
68
 
69
- ### Debugger function
70
- @churn_predictor_api.post('/v1/customer')
71
- def predict_churn():
72
- try:
73
- customer_data = request.get_json()
74
- sample = {
75
 
76
- 'Partner': customer_data['Partner'],
77
- 'Dependents': customer_data['Dependents'],
78
- 'PhoneService': customer_data['PhoneService'],
79
- 'InternetService': customer_data['InternetService'],
80
- 'Contract': customer_data['Contract'],
81
- 'PaymentMethod': customer_data['PaymentMethod'],
82
- 'tenure': customer_data['tenure'],
83
- 'MonthlyCharges': customer_data['MonthlyCharges'],
84
- 'TotalCharges': customer_data['TotalCharges'],
85
- 'SeniorCitizen':customer_data['SeniorCitizen']
86
- }
87
 
88
 
89
- input_data = pd.DataFrame([sample])
90
- prediction = model.predict(input_data).tolist()[0]
91
- prediction_label = "churn" if prediction == 1 else "not churn"
92
- return jsonify({'Prediction': prediction_label})
93
- except Exception as e:
94
- return jsonify({"error": str(e)}), 500
95
  ### debugger Ends
96
 
97
  # Run the Flask app in debug mode
 
66
 
67
  return output_dict
68
 
69
+ # ### Debugger function
70
+ # @churn_predictor_api.post('/v1/customer')
71
+ # def predict_churn():
72
+ # try:
73
+ # customer_data = request.get_json()
74
+ # sample = {
75
 
76
+ # 'Partner': customer_data['Partner'],
77
+ # 'Dependents': customer_data['Dependents'],
78
+ # 'PhoneService': customer_data['PhoneService'],
79
+ # 'InternetService': customer_data['InternetService'],
80
+ # 'Contract': customer_data['Contract'],
81
+ # 'PaymentMethod': customer_data['PaymentMethod'],
82
+ # 'tenure': customer_data['tenure'],
83
+ # 'MonthlyCharges': customer_data['MonthlyCharges'],
84
+ # 'TotalCharges': customer_data['TotalCharges'],
85
+ # 'SeniorCitizen':customer_data['SeniorCitizen']
86
+ # }
87
 
88
 
89
+ # input_data = pd.DataFrame([sample])
90
+ # prediction = model.predict(input_data).tolist()[0]
91
+ # prediction_label = "churn" if prediction == 1 else "not churn"
92
+ # return jsonify({'Prediction': prediction_label})
93
+ # except Exception as e:
94
+ # return jsonify({"error": str(e)}), 500
95
  ### debugger Ends
96
 
97
  # Run the Flask app in debug mode