Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- app.py +47 -0
- model.joblib +3 -0
- requirements.txt +5 -0
- unique_values.joblib +3 -0
app.py
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import joblib
|
2 |
+
import pandas as pd
|
3 |
+
import streamlit as st
|
4 |
+
|
5 |
+
|
6 |
+
model = joblib.load('model.joblib')
|
7 |
+
unique_values = joblib.load('unique_values.joblib')
|
8 |
+
|
9 |
+
unique_education = unique_values["education"]
|
10 |
+
unique_self_employed = unique_values["self_employed"]
|
11 |
+
|
12 |
+
|
13 |
+
def main():
|
14 |
+
st.title("Loan Approve Prediction")
|
15 |
+
|
16 |
+
with st.form("questionaire"):
|
17 |
+
education = st.selectbox("Education", unique_education)
|
18 |
+
self_employed = st.selectbox("Self Employed", unique_self_employed)
|
19 |
+
no_of_dependents = st.slider("Number of Dependents", min_value=0 ,max_value=10)
|
20 |
+
income_annum = st.slider("Income Per Year",min_value=200000, max_value=1000000)
|
21 |
+
loan_amount = st.slider("Loan Amount", min_value=300000, max_value=40000000)
|
22 |
+
loan_term = st.slider("Loan Term (Year)", min_value=2, max_value=20)
|
23 |
+
cibil_score = st.slider("CIBIL Score", min_value=300, max_value=900)
|
24 |
+
residential_assets_value = st.slider("Residential Assets Value", min_value=-100000, max_value=30000000)
|
25 |
+
commercial_assets_value = st.slider("Commercial Assets Value", min_value=0,max_value=20000000)
|
26 |
+
luxury_assets_value = st.slider("Luxury Assets Value", min_value=0,max_value=50000000)
|
27 |
+
bank_asset_value = st.slider("Bank Assets Value", min_value=0,max_value=20000000)
|
28 |
+
|
29 |
+
clicked = st.form_submit_button("Loan Approve Prediction")
|
30 |
+
if clicked:
|
31 |
+
result=model.predict(pd.DataFrame({"no_of_dependents": [no_of_dependents],
|
32 |
+
"education": [education],
|
33 |
+
"self_employed": [self_employed],
|
34 |
+
"income_annum": [income_annum],
|
35 |
+
"loan_amount": [loan_amount],
|
36 |
+
"loan_term": [loan_term],
|
37 |
+
"cibil_score": [cibil_score],
|
38 |
+
"residential_assets_value": [residential_assets_value],
|
39 |
+
"commercial_assets_value": [commercial_assets_value],
|
40 |
+
"luxury_assets_value": [luxury_assets_value],
|
41 |
+
"bank_asset_value": [bank_asset_value]
|
42 |
+
}))
|
43 |
+
result = 'Approved' if result[0] == 1 else 'Declined'
|
44 |
+
st.success('The prediction of loan approval is {}'.format(result))
|
45 |
+
|
46 |
+
if __name__=='__main__':
|
47 |
+
main()
|
model.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0aee062cc8cdde4d12a54b73a643d93be3e38f5e60597bce004015eb36e48c24
|
3 |
+
size 9662
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
joblib
|
2 |
+
pandas
|
3 |
+
scikit-learn== 1.6.1
|
4 |
+
LightGBM==1.13.1
|
5 |
+
altair<5
|
unique_values.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6664a7ab1d9d9f7bce93db3a7b97600ffae7eef2d3e52289a325aaaf0e0c9c6c
|
3 |
+
size 742
|