OatNapat commited on
Commit
b7fbdcd
1 Parent(s): 8269649

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +81 -41
app.py CHANGED
@@ -1,53 +1,93 @@
1
  import joblib
2
  import pandas as pd
3
- import streamlit as st
4
 
5
 
6
- model = joblib.load('model.joblib')
7
- unique_values = joblib.load('unique_values.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
- "Married/Single": [Married_Single],
42
- "House_Ownership": [House_Ownership],
43
- "Car_Ownership": [Car_Ownership],
44
- "Profession": [Profession],
45
- "CITY": [CITY],
46
- "STATE": [STATE],
47
- "CURRENT_JOB_YRS": [CURRENT_JOB_YRS],
48
- "CURRENT_HOUSE_YRS": [CURRENT_HOUSE_YRS]}))
49
- result = 'none_risk_flag' if result[0] == 1 else 'risk_flag'
50
- st.success('The predicted is {}'.format(result))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  if __name__=='__main__':
53
- main()
 
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_map = unique_values["map"]
10
+ unique_player= unique_values["player"]
 
 
 
 
11
 
12
 
13
  def main():
14
+ st.title("agent Analysis")
15
 
16
  with st.form("questionaire"):
17
+ rating= st.slider("rating", min_value=0.01, max_value=2.5)
18
+ acs= st.slider("acs", min_value=35, max_value=450)
19
+ kill = st.slider("kill", min_value=0, max_value=50)
20
+ death = st.slider("death", min_value=0, max_value=40)
21
+ assist = st.slider("assist", min_value=0, max_value=40)
22
+ kast% = st.slider("kast%", min_value=10, max_value=100)
23
+ adr = st.slider("adr", min_value=20, max_value=300)
24
+ hs% = st.slider("hs%", min_value=0, max_value=75)
25
+ fk = st.slider("fk", min_value=0, max_value=15)
26
+ fd = st.slider("fd", min_value=0, max_value=15)
27
+
28
+ map = st.selectbox("map", unique_map)
29
+ player = st.selectbox("player", unique_player)
30
+
31
+
32
+ clicked = st.form_submit_button("Predict agent")
33
  if clicked:
34
+ result=model.predict(pd.DataFrame({"map": [map],
35
+ "player": [player],
36
+ "rating": [rating],
37
+ "acs": [acs],
38
+ "kill": [kill],
39
+ "death": [death],
40
+ "assist": [assist],
41
+ "kast%": [kast%],
42
+ "adr": [adr],
43
+ "hs%": [hs%],
44
+ "fk": [fk],
45
+ "fd": [fd]}))
46
+
47
+ if result[0] == 18:
48
+ result = 'sova'
49
+ elif result[0] == 10:
50
+ result = 'killjoy'
51
+ elif result[0] == 8:
52
+ result = 'jett'
53
+ elif result[0] == 9:
54
+ result = 'kayo'
55
+ elif result[0] == 12:
56
+ result = 'omen'
57
+ elif result[0] == 19:
58
+ result = 'viper'
59
+ elif result[0] == 17:
60
+ result = 'skye'
61
+ elif result[0] == 7:
62
+ result = 'harbor'
63
+ elif result[0] == 5:
64
+ result = 'fade'
65
+ elif result[0] == 0:
66
+ result = 'astra'
67
+ elif result[0] == 1:
68
+ result = 'breach'
69
+ elif result[0] == 14:
70
+ result = 'raze'
71
+ elif result[0] == 13:
72
+ result = 'phoenix'
73
+ elif result[0] == 20:
74
+ result = 'yoru'
75
+ elif result[0] == 4:
76
+ result = 'cypher'
77
+ elif result[0] == 16:
78
+ result = 'sage'
79
+ elif result[0] == 2:
80
+ result = 'brimstone'
81
+ elif result[0] == 11:
82
+ result = 'neon'
83
+ elif result[0] == 6:
84
+ result = 'gekko'
85
+ elif result[0] == 15:
86
+ result = 'reyna'
87
+ elif result[0] == 3:
88
+ result = 'chamber'
89
+
90
+ st.success('The predicted agent is {}'.format(result))
91
 
92
  if __name__=='__main__':
93
+ main()