This model predicts the risk of stroke based on demographic and health-related features.
1import requests
2
3API_URL = "https://abdullah1211-ml-stroke.hf.space"
4headers = {"Content-Type": "application/json"}
5
6def query(payload):
7 response = requests.post(API_URL, headers=headers, json=payload)
8 return response.json()
9
10data = {
11 "gender": "Male",
12 "age": 67,
13 "hypertension": 1,
14 "heart_disease": 0,
15 "ever_married": "Yes",
16 "work_type": "Private",
17 "Residence_type": "Urban",
18 "avg_glucose_level": 228.69,
19 "bmi": 36.6,
20 "smoking_status": "formerly smoked"
21}
22
23output = query(data)
24print(output)
1{
2 "probability": 0.72,
3 "prediction": "High Risk",
4 "stroke_prediction": 1
5}