Spaces:
Sleeping
Sleeping
Delete GetPredictions.py
Browse files- GetPredictions.py +0 -27
GetPredictions.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
import pandas as pd
|
| 2 |
-
|
| 3 |
-
def GetPredictions(model, inputs):
|
| 4 |
-
|
| 5 |
-
df = pd.DataFrame([inputs])
|
| 6 |
-
|
| 7 |
-
df['Gender'] = df['Gender'].map({'Male': 1, 'Female': 0})
|
| 8 |
-
df['Region'] = df['Region'].map({'Urban': 0, 'Rural': 1, 'Suburban': 0.5})
|
| 9 |
-
df['Exercise_Level'] = df['Exercise_Level'].map({'Low': 0, 'High': 1, 'Moderate': 0.5})
|
| 10 |
-
df['Diet'] = df['Diet'].map({'Unhealthy': 0, 'Healthy': 1, 'Mixed': 0.5})
|
| 11 |
-
df['Occupation'] = df['Occupation'].map({'Unemployed': 0, 'Employed': 2, 'Student': 1, 'Retired': 3})
|
| 12 |
-
df['Income_Level'] = df['Income_Level'].map({'Low': 0, 'High': 1, 'Middle': 0.5})
|
| 13 |
-
df['Physical_Activity'] = df['Physical_Activity'].map({'Low': 0, 'High': 1, 'Moderate': 0.5})
|
| 14 |
-
df['Education_Level'] = df['Education_Level'].map({'Primary': 0, 'Higher': 2, 'Secondary': 1})
|
| 15 |
-
df['Marital_Status'] = df['Marital_Status'].map({'Single': 0, 'Married': 1, 'Divorced': 2, 'Widowed': 3})
|
| 16 |
-
df['Smoking'] = df['Smoking'].map({'True': 1, 'False': 0})
|
| 17 |
-
df['Diabetes'] = df['Diabetes'].map({'True': 1, 'False': 0})
|
| 18 |
-
df['Family_History'] = df['Family_History'].map({'True': 1, 'False': 0})
|
| 19 |
-
df['Angina'] = df['Angina'].map({'True': 1, 'False': 0})
|
| 20 |
-
df['Heart_Disease_History'] = df['Heart_Disease_History'].map({'True': 1, 'False': 0})
|
| 21 |
-
df['Medication'] = df['Medication'].map({'True': 1, 'False': 0})
|
| 22 |
-
df['Obesity'] = df['Obesity'].map({'True': 1, 'False': 0})
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
prediction = model.predict([df.to_numpy()[0]])[0]
|
| 26 |
-
|
| 27 |
-
return prediction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|