kingabzpro commited on
Commit
aa1126a
·
1 Parent(s): 7e0da36

first commit

Browse files
Files changed (2) hide show
  1. app.py +64 -0
  2. loan_classifier.joblib +3 -0
app.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ import joblib
4
+
5
+ # Load the trained model
6
+ model = joblib.load('loan_classifier.joblib')
7
+
8
+
9
+
10
+
11
+ def predict_loan_status(int_rate,
12
+ installment,
13
+ log_annual_inc,
14
+ dti,
15
+ fico,
16
+ revol_bal,
17
+ revol_util,
18
+ inq_last_6mths,
19
+ delinq_2yrs,
20
+ pub_rec,
21
+ installment_to_income_ratio,
22
+ credit_history):
23
+ input_dict = {
24
+ 'int.rate': int_rate,
25
+ 'installment': installment,
26
+ 'log.annual.inc': log_annual_inc,
27
+ 'dti': dti,
28
+ 'fico': fico,
29
+ 'revol.bal': revol_bal,
30
+ 'revol.util': revol_util,
31
+ 'inq.last.6mths': inq_last_6mths,
32
+ 'delinq.2yrs': delinq_2yrs,
33
+ 'pub.rec': pub_rec,
34
+ 'installment_to_income_ratio': installment_to_income_ratio,
35
+ 'credit_history': credit_history
36
+ }
37
+ # Convert the dictionary to a 2D array
38
+ input_array = [list(input_dict.values())]
39
+ prediction = model.predict(input_array)[0]
40
+
41
+ if prediction == 0:
42
+ return "Loan fully paid"
43
+ else:
44
+ return "Loan not fully paid"
45
+
46
+ inputs = [
47
+ gr.Slider(0.06, 0.23, step=0.01, label="Interest Rate"),
48
+ gr.Slider(100, 950, step=10, label="Installment"),
49
+ gr.Slider(7, 15, step=0.1, label="Log Annual Income"),
50
+ gr.Slider(0, 40, step=1, label="DTI Ratio"),
51
+ gr.Slider(600, 850, step=1, label="FICO Score"),
52
+ gr.Slider(0, 120000, step=1000, label="Revolving Balance"),
53
+ gr.Slider(0, 120, step=1, label="Revolving Utilization"),
54
+ gr.Slider(0, 10, step=1, label="Inquiries in Last 6 Months"),
55
+ gr.Slider(0, 20, step=1, label="Delinquencies in Last 2 Years"),
56
+ gr.Slider(0, 10, step=1, label="Public Records"),
57
+ gr.Slider(0, 5, step=0.1, label="Installment to Income Ratio"),
58
+ gr.Slider(0, 1, step=0.01, label="Credit History"),
59
+ ]
60
+ outputs = [gr.Label(num_top_classes=2)]
61
+
62
+ title = "Loan Approval Classifier"
63
+ description = "Enter the details of the loan applicant to check if the loan is approved or not."
64
+ gr.Interface(fn=predict_loan_status, inputs=inputs, outputs=outputs, title=title, description=description).launch()
loan_classifier.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:991d8d301202fce392585331b05b533480816e46cd4a7fe289d61531a17660af
3
+ size 22576512