OatNapat commited on
Commit
bf756d2
1 Parent(s): caf20f8

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +53 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import pandas as pd
3
+ import streamlit as st
4
+
5
+
6
+ model = joblib.load('model (1).joblib')
7
+ unique_values = joblib.load('unique_values (1).joblib')
8
+
9
+ unique_Married_Single = unique_values["Married/Single"]
10
+ unique_House_Ownership = unique_values["House_Ownership"]
11
+ unique_Car_Ownership = unique_values["Car_Ownership"]
12
+ unique_Profession = unique_values["Profession"]
13
+ unique_CITY = unique_values["CITY"]
14
+ unique_STATE = unique_values["STATE"]
15
+
16
+
17
+ def main():
18
+ st.title("Loan Risk_Flag Analysis")
19
+
20
+ with st.form("questionaire"):
21
+ Income = st.slider("Income", min_value=10000, max_value=9999999)
22
+ Age = st.slider("Age", min_value=10, max_value=100)
23
+ Experience = st.slider("Experience", min_value=0, max_value=20)
24
+ CURRENT_JOB_YRS = st.slider("CURRENT_JOB_YRS", min_value=0, max_value=14)
25
+ CURRENT_HOUSE_YRS = st.slider("CURRENT_HOUSE_YRS", min_value=10, max_value=14)
26
+
27
+ Married_Single = st.selectbox("Married/Single", unique_Married_Single)
28
+ House_Ownership = st.selectbox("House_Ownership", unique_House_Ownership)
29
+ Car_Ownership = st.selectbox("Car_Ownership", unique_Car_Ownership)
30
+ Profession = st.selectbox("Profession", unique_Profession)
31
+ CITY = st.selectbox("CITY", unique_CITY)
32
+ STATE = st.selectbox("STATE", unique_STATE)
33
+
34
+
35
+
36
+ clicked = st.form_submit_button("Predict Risk_Flag")
37
+ if clicked:
38
+ result=model.predict(pd.DataFrame({"Income": [Income],
39
+ "Age": [Age],
40
+ "Experience": [Experience],
41
+ "CURRENT_JOB_YRS": [CURRENT_JOB_YRS],
42
+ "CURRENT_HOUSE_YRS": [CURRENT_HOUSE_YRS],
43
+ "Married_Single": [Married_Single],
44
+ "House_Ownership": [House_Ownership],
45
+ "Car_Ownership": [Car_Ownership],
46
+ "Profession": [Profession],
47
+ "CITY": [CITY],
48
+ "STATE": [STATE]}))
49
+ result = 'none_risk_flag' if result[0] == 1 else 'risk_flag'
50
+ st.success('The predicted income is {}'.format(result))
51
+
52
+ if __name__=='__main__':
53
+ main()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ joblib
2
+ pandas
3
+ scikit-learn==1.2.2
4
+ xgboost==1.7.6
5
+ altair<5