Spaces:
Sleeping
Sleeping
import joblib | |
import pandas as pd | |
import streamlit as st | |
model = joblib.load('model.joblib') | |
unique_values = joblib.load('unique_values.joblib') | |
unique_education = unique_values["education"] | |
unique_self_employed = unique_values["self_employed"] | |
def main(): | |
st.title("Loan Approve Prediction") | |
with st.form("questionaire"): | |
education = st.selectbox("Education", unique_education) | |
self_employed = st.selectbox("Self Employed", unique_self_employed) | |
no_of_dependents = st.slider("Number of Dependents", min_value=0 ,max_value=10) | |
income_annum = st.slider("Income Per Year",min_value=200000, max_value=1000000) | |
loan_amount = st.slider("Loan Amount", min_value=300000, max_value=40000000) | |
loan_term = st.slider("Loan Term (Year)", min_value=2, max_value=20) | |
cibil_score = st.slider("CIBIL Score", min_value=300, max_value=900) | |
residential_assets_value = st.slider("Residential Assets Value", min_value=-100000, max_value=30000000) | |
commercial_assets_value = st.slider("Commercial Assets Value", min_value=0,max_value=20000000) | |
luxury_assets_value = st.slider("Luxury Assets Value", min_value=0,max_value=50000000) | |
bank_asset_value = st.slider("Bank Assets Value", min_value=0,max_value=20000000) | |
clicked = st.form_submit_button("Loan Approve Prediction") | |
if clicked: | |
result=model.predict(pd.DataFrame({"no_of_dependents": [no_of_dependents], | |
"education": [education], | |
"self_employed": [self_employed], | |
"income_annum": [income_annum], | |
"loan_amount": [loan_amount], | |
"loan_term": [loan_term], | |
"cibil_score": [cibil_score], | |
"residential_assets_value": [residential_assets_value], | |
"commercial_assets_value": [commercial_assets_value], | |
"luxury_assets_value": [luxury_assets_value], | |
"bank_asset_value": [bank_asset_value] | |
})) | |
result = 'Approved' if result[0] == 1 else 'Declined' | |
st.success('The prediction of loan approval is {}'.format(result)) | |
if __name__=='__main__': | |
main() | |