Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,8 +36,8 @@ def scaler(data, runtime = False):
|
|
36 |
X_train = scaler(X_train)
|
37 |
X_test = scaler(X_test, True)
|
38 |
|
39 |
-
|
40 |
-
|
41 |
|
42 |
features = {
|
43 |
"person_home_ownership": ['MORTGAGE', 'OTHER','OWN', 'RENT',],
|
@@ -76,7 +76,7 @@ def credit_run(person_age, person_income, person_home_ownership,
|
|
76 |
'cb_person_cred_hist_length': cb_person_cred_hist_length
|
77 |
}, index = [0]
|
78 |
))
|
79 |
-
out =
|
80 |
return "High risk of defaulting" if out[0] == 1 else "Low risk of defaulting"
|
81 |
|
82 |
demo = gr.Interface(
|
@@ -93,14 +93,6 @@ demo = gr.Interface(
|
|
93 |
gr.Radio(['N', 'Y'],label="Person Defaulted in History"),
|
94 |
gr.Number(label="Person's Credit History Length"),
|
95 |
],
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
outputs = gr.Radio(['Low risk of defaulting', 'High risk of defaulting']),
|
105 |
title = "Non Payment Credit Risk Predictor",
|
106 |
theme=gr.themes.Soft(),
|
|
|
36 |
X_train = scaler(X_train)
|
37 |
X_test = scaler(X_test, True)
|
38 |
|
39 |
+
model = RandomForestClassifier(max_depth = 5)
|
40 |
+
model.fit(X_train, y_train)
|
41 |
|
42 |
features = {
|
43 |
"person_home_ownership": ['MORTGAGE', 'OTHER','OWN', 'RENT',],
|
|
|
76 |
'cb_person_cred_hist_length': cb_person_cred_hist_length
|
77 |
}, index = [0]
|
78 |
))
|
79 |
+
out = model.predict(model_input)
|
80 |
return "High risk of defaulting" if out[0] == 1 else "Low risk of defaulting"
|
81 |
|
82 |
demo = gr.Interface(
|
|
|
93 |
gr.Radio(['N', 'Y'],label="Person Defaulted in History"),
|
94 |
gr.Number(label="Person's Credit History Length"),
|
95 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
outputs = gr.Radio(['Low risk of defaulting', 'High risk of defaulting']),
|
97 |
title = "Non Payment Credit Risk Predictor",
|
98 |
theme=gr.themes.Soft(),
|