telco-churn-predictor / scripts /test_fastapi.py
logan-codes's picture
Add pipeline scripts, tests and deps
07e37a4
raw
history blame contribute delete
732 Bytes
import requests
url = "http://127.0.0.1:8000/predict"
sample_data = {
"gender": "Male",
"SeniorCitizen": 0,
"Partner": "Yes",
"Dependents": "No",
"tenure": 5,
"PhoneService": "Yes",
"MultipleLines": "No",
"InternetService": "Fiber optic",
"OnlineSecurity": "No",
"OnlineBackup": "Yes",
"DeviceProtection": "No",
"TechSupport": "No",
"StreamingTV": "Yes",
"StreamingMovies": "Yes",
"Contract": "Month-to-month",
"PaperlessBilling": "Yes",
"PaymentMethod": "Electronic check",
"MonthlyCharges": 70.35,
"TotalCharges": 350.75
}
response = requests.post(url, json=sample_data)
print("Status Code:", response.status_code)
print("Response:", response.json())