ShanRaja commited on
Commit
a3b7e23
·
verified ·
1 Parent(s): 61d01ee

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -42,6 +42,26 @@ input_data = pd.DataFrame([{
42
  # Set classification threshold
43
  classification_threshold = 0.5
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  # Predict button
46
  if st.button("Predict"):
47
  prediction_proba = model.predict_proba(input_data)[0, 1]
 
42
  # Set classification threshold
43
  classification_threshold = 0.5
44
 
45
+ # Correction made to the codes
46
+
47
+ input_df = pd.DataFrame([input_data])
48
+
49
+ categorical_cols = [
50
+ 'Partner', # Whether the customer has a partner (Yes/No)
51
+ 'Dependents', # Whether the customer has dependents (Yes/No)
52
+ 'PhoneService', # Whether the customer has phone service (Yes/No)
53
+ 'InternetService', # Type of internet service (DSL, Fiber optic, No)
54
+ 'Contract', # Type of contract (Month-to-month, One year, Two year)
55
+ 'PaymentMethod', # Customer's preferred payment method
56
+ # same as training
57
+ ]
58
+
59
+ input_df[categorical_cols] = (
60
+ input_df[categorical_cols]
61
+ .astype(str)
62
+ .fillna("missing")
63
+ )
64
+
65
  # Predict button
66
  if st.button("Predict"):
67
  prediction_proba = model.predict_proba(input_data)[0, 1]