File size: 3,587 Bytes
bf756d2
 
b7fbdcd
bf756d2
 
b7fbdcd
 
 
 
 
bf756d2
 
 
b7fbdcd
bf756d2
 
5959ae3
 
 
 
 
 
 
 
 
 
 
 
b7fbdcd
 
 
 
bf756d2
b7fbdcd
 
 
 
 
 
 
0df1652
b7fbdcd
0df1652
b7fbdcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bf756d2
 
b7fbdcd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import joblib
import pandas as pd
import streamlit as st


model = joblib.load('model (1).joblib')
unique_values = joblib.load('unique_values (1).joblib')

unique_map =  unique_values["map"]
unique_player=  unique_values["player"]


def main():
    st.title("agent Analysis")

    with st.form("questionaire"):
        rating= st.slider("Rating in game", min_value=0.01, max_value=2.5)
        acs= st.slider("Average Combat Score", min_value=35, max_value=450)
        kill = st.slider("Number of Kill Accumulated", min_value=0, max_value=50)
        death = st.slider("Number of Death Accumulated", min_value=0, max_value=40)
        assist = st.slider("Number of Assist Accumulated", min_value=0, max_value=40)
        kast = st.slider("Percentage of Kill, Assist, Survive, Trade", min_value=10, max_value=100)
        adr = st.slider("Average damage dealt during a game", min_value=20, max_value=300)
        hs = st.slider("Headshot percentage", min_value=0, max_value=75)
        fk = st.slider("First kill count", min_value=0, max_value=15)
        fd = st.slider("First death count", min_value=0, max_value=15)

        map = st.selectbox("Name of map played", unique_map)
        player = st.selectbox("player", unique_player)


        clicked = st.form_submit_button("Predict agent")
        if clicked:
            result=model.predict(pd.DataFrame({"map": [map],
                                               "player": [player],
                                               "rating": [rating],
                                               "acs": [acs],
                                               "kill": [kill],
                                               "death": [death],
                                               "assist": [assist],
                                               "kast%": [kast],
                                               "adr": [adr],
                                               "hs%": [hs],
                                               "fk": [fk],
                                               "fd": [fd]}))
            
            if result[0] == 18:
                result = 'sova'
            elif result[0] == 10:
                result = 'killjoy'
            elif result[0] == 8:
                result = 'jett'
            elif result[0] == 9:
                result = 'kayo'
            elif result[0] == 12:
                result = 'omen'
            elif result[0] == 19:
                result = 'viper'
            elif result[0] == 17:
                result = 'skye'
            elif result[0] == 7:
                result = 'harbor'
            elif result[0] == 5:
                result = 'fade'
            elif result[0] == 0:
                result = 'astra'
            elif result[0] == 1:
                result = 'breach'
            elif result[0] == 14:
                result = 'raze'
            elif result[0] == 13:
                result = 'phoenix'
            elif result[0] == 20:
                result = 'yoru'
            elif result[0] == 4:
                result = 'cypher'
            elif result[0] == 16:
                result = 'sage'
            elif result[0] == 2:
                result = 'brimstone'
            elif result[0] == 11:
                result = 'neon'
            elif result[0] == 6:
                result = 'gekko'
            elif result[0] == 15:
                result = 'reyna'
            elif result[0] == 3:
                result = 'chamber'

            st.success('The predicted agent is {}'.format(result))

if __name__=='__main__':
    main()