Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pycaret.classification import load_model, predict_model
- import streamlit as st
- import pandas as pd
- model=load_model('Logistic regression')
- def predict(model, input_df):
- predictions_df=predict_model(estimator=model,data=input_df)
- predictions=predictions_df['Label'][0]
- return predictions
- def run():
- st.title("Welcome to Dream Finance Housing Company")
- Gender=st.selectbox('Gender',['Male', 'Female'])
- Married=st.selectbox('Married',['Yes', 'No'])
- Dependents=st.selectbox('Dependents',['0','1','2','3+'])
- Education=st.selectbox('Education',['Graduate', 'Not Graduate'])
- Self_Employed=st.selectbox('Self Employed',['Yes', 'No'])
- ApplicantIncome=st.number_input('Applicant Income', min_value=1, max_value=100000)
- CoapplicantIncome=st.number_input('Coapplicant Income', min_value=0, max_value=100000)
- LoanAmount=st.number_input('Loan Amount', min_value=1)
- Loan_Amount_Term=st.selectbox('Term of Loan Amount',['60','120','180','240','300','360'])
- Credit_History=st.selectbox('Credit History',['0','1'])
- Property_Area=st.selectbox('Select your Area Category',['Urban','Semiurban','Rural'])
- output=""
- input_dict={'Gender':Gender,
- 'Married': Married,
- 'Dependents':Dependents,
- 'Education':Education,
- 'Self_Employed':Self_Employed,
- 'ApplicantIncome':ApplicantIncome,
- 'CoapplicantIncome':CoapplicantIncome,
- 'LoanAmount':LoanAmount,
- 'Loan_Amount_Term':Loan_Amount_Term,
- 'Credit_History':Credit_History,
- 'Property_Area':Property_Area}
- input_df=pd.DataFrame([input_dict])
- if st.button("Check"):
- output=predict(model=model, input_df=input_df)
- output=str(output)
- st.success('Your Loan Eligibility Status {}'.format(output))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement