Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
10 |
-
|
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("
|
19 |
|
20 |
with st.form("questionaire"):
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
clicked = st.form_submit_button("Predict
|
37 |
if clicked:
|
38 |
-
result=model.predict(pd.DataFrame({"
|
39 |
-
"
|
40 |
-
"
|
41 |
-
"
|
42 |
-
"
|
43 |
-
"
|
44 |
-
"
|
45 |
-
"
|
46 |
-
"
|
47 |
-
"
|
48 |
-
"
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|