Update handler.py

#1
by philschmid HF staff - opened

You are loading a {"inputs": {{"customerID": {"0": "7590-VHVEG", "1": "5575-GNVDE", ...}} as dataframe -> which ends up as 1 column thats why you receive the KeyError.

After change you should be able to use the following example body:

{
  "inputs": {"customerID": {"0": "7590-VHVEG", "1": "5575-GNVDE", "2": "3668-QPYBK"}, "gender": {"0": "Female", "1": "Male", "2": "Male"}, "SeniorCitizen": {"0": 0, "1": 0, "2": 0}, "Partner": {"0": "Yes", "1": "No", "2": "No"}, "Dependents": {"0": "No", "1": "No", "2": "No"}, "tenure": {"0": 1, "1": 34, "2": 2}, "PhoneService": {"0": "No", "1": "Yes", "2": "Yes"}, "MultipleLines": {"0": "No phone service", "1": "No", "2": "No"}, "InternetService": {"0": "DSL", "1": "DSL", "2": "DSL"}, "OnlineSecurity": {"0": "No", "1": "Yes", "2": "Yes"}, "OnlineBackup": {"0": "Yes", "1": "No", "2": "Yes"}, "DeviceProtection": {"0": "No", "1": "Yes", "2": "No"}, "TechSupport": {"0": "No", "1": "No", "2": "No"}, "StreamingTV": {"0": "No", "1": "No", "2": "No"}, "StreamingMovies": {"0": "No", "1": "No", "2": "No"}, "Contract": {"0": "Month-to-month", "1": "One year", "2": "Month-to-month"}, "PaperlessBilling": {"0": "Yes", "1": "No", "2": "Yes"}, "PaymentMethod": {"0": "Electronic check", "1": "Mailed check", "2": "Mailed check"}, "MonthlyCharges": {"0": 29.85, "1": 56.95, "2": 53.85}, "TotalCharges": {"0": "29.85", "1": "1889.5", "2": "108.15"}, "Churn": {"0": "No", "1": "No", "2": "Yes"}}
}
rajistics changed pull request status to merged

Sign up or log in to comment