Spaces:
Sleeping
Sleeping
Arunachalam S
commited on
Commit
•
d719f82
1
Parent(s):
c6bd4ac
adding app
Browse files- app.py +48 -0
- model.joblib +3 -0
- requirements.txt +4 -0
app.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import joblib
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
st.title("Welcome to ABC Bank")
|
6 |
+
|
7 |
+
model = joblib.load('model.joblib')
|
8 |
+
#Even though we are not going to use gender to predict the loan status,
|
9 |
+
#we will be getting the gender data for future plans/schemes.
|
10 |
+
with st.form('Loan Form'):
|
11 |
+
col1,col2 = st.columns(2)
|
12 |
+
with col1:
|
13 |
+
Gender = st.selectbox('Gender',('Male','Female'))
|
14 |
+
Applicant_Income = st.number_input('Applicant Income',min_value=0)
|
15 |
+
Coapplicant_Income = st.number_input('Co-applicant Income',min_value=0)
|
16 |
+
Loan_amount = st.number_input('Loan Amount',min_value=0)
|
17 |
+
Loan_Amount_Term = st.number_input('Loan Amount Term (Months)',min_value=0)
|
18 |
+
with col2:
|
19 |
+
Property_Area = st.selectbox('Property Area',('Urban','Rural','Semiurban'))
|
20 |
+
Credit_History = st.number_input('Credit History',min_value=0,max_value=1)
|
21 |
+
Self_Employed = st.selectbox('Self Employed',('Yes','No'))
|
22 |
+
Dependents = st.selectbox('Dependents',('0','1','2','3','3+'))
|
23 |
+
Education = st.selectbox('Education',('Graduate','Not Graduate'))
|
24 |
+
Married = st.selectbox('Married',('Yes','No'))
|
25 |
+
|
26 |
+
df = pd.DataFrame({
|
27 |
+
'Married': [Married],
|
28 |
+
'Dependents': [Dependents],
|
29 |
+
'Education': [Education],
|
30 |
+
'Self_Employed': [Self_Employed],
|
31 |
+
'Applicant_Income': [Applicant_Income],
|
32 |
+
'Coapplicant_Income': [Coapplicant_Income],
|
33 |
+
'Loan_Amount': [Loan_amount],
|
34 |
+
'Loan_Amount_Term': [Loan_Amount_Term],
|
35 |
+
'Credit_History': [Credit_History],
|
36 |
+
'Property_Area': [Property_Area]}
|
37 |
+
)
|
38 |
+
submit = st.form_submit_button('Predict')
|
39 |
+
if submit:
|
40 |
+
prediction = model.predict(df)
|
41 |
+
if prediction:
|
42 |
+
st.success('Congratulations, Your Home Loan is Approved!!')
|
43 |
+
else:
|
44 |
+
st.error('We are extremely sorry to inform you that you Home Loan is not approved. Please reach out to nearest Branch for further clarification')
|
45 |
+
|
46 |
+
st.write(df)
|
47 |
+
|
48 |
+
|
model.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7167812dfb03f255d78695e8936eead9bd5fb0790ff99d819401ef85537b2a64
|
3 |
+
size 5518
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit==1.12.0
|
2 |
+
pandas==2.0.3
|
3 |
+
scikit-learn==1.2.2
|
4 |
+
joblib==1.3.2
|