NatalieCheong commited on
Commit
12a6963
·
verified ·
1 Parent(s): 12dc7fd

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -82
app.py DELETED
@@ -1,82 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """app.py
3
-
4
- Automatically generated by Colab.
5
-
6
- Original file is located at
7
- https://colab.research.google.com/drive/1HA1-9-ihiCRkIXjb9NYEMkTROJNa_715
8
- """
9
-
10
- import gradio as gr
11
- import joblib
12
- # Load the trained model
13
- model = joblib.load("loan_classifier.joblib")
14
- #scaler = joblib.load("std_scaler.bin")
15
-
16
-
17
- def predict_loan_status(
18
- int_rate,
19
- installment,
20
- log_annual_inc,
21
- dti,
22
- fico,
23
- revol_bal,
24
- revol_util,
25
- inq_last_6mths,
26
- delinq_2yrs,
27
- pub_rec,
28
- installment_to_income_ratio,
29
- credit_history,
30
- ):
31
- input_dict = {
32
- "int.rate": int_rate,
33
- "installment": installment,
34
- "log.annual.inc": log_annual_inc,
35
- "dti": dti,
36
- "fico": fico,
37
- "revol.bal": revol_bal,
38
- "revol.util": revol_util,
39
- "inq.last.6mths": inq_last_6mths,
40
- "delinq.2yrs": delinq_2yrs,
41
- "pub.rec": pub_rec,
42
- "installment_to_income_ratio": installment_to_income_ratio,
43
- "credit_history": credit_history,
44
- }
45
- # Convert the dictionary to a 2D array
46
- input_array = [list(input_dict.values())]
47
- scaled_array = scalar.transform(input_array)
48
- prediction = model.predict(scaled_array)[0]
49
-
50
- if prediction == 0:
51
- return "Loan fully paid"
52
- else:
53
- return "Loan not fully paid"
54
-
55
-
56
- inputs = [
57
- gr.Slider(0.06, 0.23, step=0.01, label="Interest Rate"),
58
- gr.Slider(100, 950, step=10, label="Installment"),
59
- gr.Slider(7, 15, step=0.1, label="Log Annual Income"),
60
- gr.Slider(0, 40, step=1, label="DTI Ratio"),
61
- gr.Slider(600, 850, step=1, label="FICO Score"),
62
- gr.Slider(0, 120000, step=1000, label="Revolving Balance"),
63
- gr.Slider(0, 120, step=1, label="Revolving Utilization"),
64
- gr.Slider(0, 10, step=1, label="Inquiries in Last 6 Months"),
65
- gr.Slider(0, 20, step=1, label="Delinquencies in Last 2 Years"),
66
- gr.Slider(0, 10, step=1, label="Public Records"),
67
- gr.Slider(0, 5, step=0.1, label="Installment to Income Ratio"),
68
- gr.Slider(0, 1, step=0.01, label="Credit History"),
69
- ]
70
- outputs = [gr.Label(num_top_classes=2)]
71
-
72
- title = "Loan Approval Classifier"
73
- description = (
74
- "Enter the details of the loan applicant to check if the loan is approved or not."
75
- )
76
- gr.Interface(
77
- fn=predict_loan_status,
78
- inputs=inputs,
79
- outputs=outputs,
80
- title=title,
81
- description=description,
82
- ).launch()