Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,34 +13,6 @@ from imblearn.over_sampling import SMOTE
|
|
13 |
import gradio as gr
|
14 |
import datasets
|
15 |
|
16 |
-
sft = ['age', 'serum_creatinine','ejection_fraction']
|
17 |
-
|
18 |
-
#data_features = datasets.Features({'text': Value('string'), 'label': ClassLabel(names=sft)})
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
#`my_dataset_dictionary['train'][['age', 'serum_creatinine', 'ejection_fraction']]`. Available splits: ['train']"
|
23 |
-
|
24 |
-
data = datasets.load_dataset("Boadiwaa/heart_data", {"train": [sft]}, ignore_verifications = True)
|
25 |
-
|
26 |
-
Features = sft
|
27 |
-
|
28 |
-
x = data[Features]
|
29 |
-
y = data["DEATH_EVENT"]
|
30 |
-
|
31 |
-
x_train,x_test,y_train,y_test = train_test_split(x,y, test_size=0.2,shuffle=False)
|
32 |
-
|
33 |
-
smote = SMOTE(sampling_strategy = 'minority', random_state = 2)
|
34 |
-
x_SMOTE, y_SMOTE = smote.fit_resample(x_train,y_train)
|
35 |
-
|
36 |
-
svc = SVC()
|
37 |
-
|
38 |
-
svc.fit(x_SMOTE, y_SMOTE)
|
39 |
-
|
40 |
-
with open("model.pkl", "wb") as f:
|
41 |
-
pickle.dump(svc, f)
|
42 |
-
|
43 |
-
|
44 |
def make_prediction(age,serum_creatinine,ejection_fraction):
|
45 |
with open("model.pkl", "rb") as f:
|
46 |
svc = pickle.load(f)
|
|
|
13 |
import gradio as gr
|
14 |
import datasets
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
def make_prediction(age,serum_creatinine,ejection_fraction):
|
17 |
with open("model.pkl", "rb") as f:
|
18 |
svc = pickle.load(f)
|