Abbas1214/Lords
0
1# -*- coding: utf-8 -*-2"""3Created on Thu Oct 24 10:18:55 20244 5@author: HP6"""7 8import pickle9import streamlit as st10import numpy as np # Ensure numpy is imported11import joblib12# Load the model13# load_model = pickle.load(open('C:/Users/HP/Desktop/Internship/Internship.sav','rb'))14load_model = joblib.load(r"model.h5")15def loan_prediction(input_data):16 # Convert input data to numpy array and reshape17 input_data_as_numpy_array = np.asarray(input_data)18 input_data_reshaped = input_data_as_numpy_array.reshape(1, -1)19 20 # Make prediction21 prediction = load_model.predict(input_data_reshaped)22 23 # Return the prediction result24 if prediction[0] == ' Rejected':25 return "Your approval is rejected"26 elif prediction[0] == ' Approved':27 return "Your approval is accepted"28 29def main():30 # Giving a title31 st.title("Hypnosis's Prediction")32 33 34 35 # Getting the input data from the user36 no_of_dependents = st.text_input("Enter the no. of dependents")37 education = st.text_input("Enter your education")38 self_employed = st.text_input("Enter your employment status")39 income_annum = st.text_input("Enter your income per annum")40 loan_amount = st.text_input("Enter your loan amount")41 loan_term = st.text_input("Enter your loan term")42 cibil_score = st.text_input("Enter your cibil score")43 residential_assets_value = st.text_input("Enter your residential assets value")44 commercial_assets_value = st.text_input("Enter your commercial assets value")45 luxury_assets_value = st.text_input("Enter your luxury assets value")46 bank_asset_value = st.text_input("Enter your bank asset value")47 48 # Code for prediction49 sanctioned = " "50 51 # Creating a button52 if st.button("Press for result :>"):53 sanctioned = loan_prediction([no_of_dependents, education, self_employed, income_annum, loan_amount, loan_term, cibil_score, residential_assets_value, commercial_assets_value, luxury_assets_value, bank_asset_value])54 55 st.success(sanctioned)56 57if __name__ == "__main__":58 main()59 