Upload 3 files
Browse files- app.py +85 -0
- model.joblib +3 -0
- unique_values.joblib +3 -0
app.py
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import joblib
|
2 |
+
import pandas as pd
|
3 |
+
import streamlit as st
|
4 |
+
import datetime
|
5 |
+
|
6 |
+
EPL_DICT = {'Matchweek 1': 1,
|
7 |
+
'Matchweek 2': 2,
|
8 |
+
'Matchweek 3': 3,
|
9 |
+
'Matchweek 4': 4,
|
10 |
+
'Matchweek 5': 5,
|
11 |
+
'Matchweek 6': 6,
|
12 |
+
'Matchweek 7': 7,
|
13 |
+
'Matchweek 8': 8,
|
14 |
+
'Matchweek 9': 9,
|
15 |
+
'Matchweek 10': 10,
|
16 |
+
'Matchweek 11': 11,
|
17 |
+
'Matchweek 12': 12,
|
18 |
+
'Matchweek 13': 13,
|
19 |
+
'Matchweek 14': 14,
|
20 |
+
'Matchweek 15': 15,
|
21 |
+
'Matchweek 16': 16,
|
22 |
+
'Matchweek 17': 17,
|
23 |
+
'Matchweek 18': 18,
|
24 |
+
'Matchweek 19': 19,
|
25 |
+
'Matchweek 20': 20,
|
26 |
+
'Matchweek 21': 21,
|
27 |
+
'Matchweek 22': 22,
|
28 |
+
'Matchweek 23': 23,
|
29 |
+
'Matchweek 24': 24,
|
30 |
+
'Matchweek 25': 25,
|
31 |
+
'Matchweek 26': 26,
|
32 |
+
'Matchweek 27': 27,
|
33 |
+
'Matchweek 28': 28,
|
34 |
+
'Matchweek 29': 29,
|
35 |
+
'Matchweek 30': 30,
|
36 |
+
'Matchweek 31': 31,
|
37 |
+
'Matchweek 32': 32,
|
38 |
+
'Matchweek 33': 33,
|
39 |
+
'Matchweek 34': 34,
|
40 |
+
'Matchweek 35': 35,
|
41 |
+
'Matchweek 36': 36,
|
42 |
+
'Matchweek 37': 37,
|
43 |
+
'Matchweek 38': 38
|
44 |
+
}
|
45 |
+
|
46 |
+
model = joblib.load('model.joblib')
|
47 |
+
unique_values = joblib.load('unique_values.joblib')
|
48 |
+
|
49 |
+
unique_comp = unique_values["comp"]
|
50 |
+
unique_round = unique_values["round"]
|
51 |
+
unique_venue = unique_values["venue"]
|
52 |
+
unique_team = unique_values["team"]
|
53 |
+
unique_opponent = unique_values["opponent"]
|
54 |
+
|
55 |
+
def main():
|
56 |
+
st.title("Premier League Analysis")
|
57 |
+
|
58 |
+
with st.form("questionaire"):
|
59 |
+
time = st.time_input("Match Time")
|
60 |
+
comp = st.selectbox("Comp", unique_comp)
|
61 |
+
round = st.selectbox("Round", unique_round)
|
62 |
+
venue = st.radio(
|
63 |
+
"Does your team play away or home?",
|
64 |
+
["***Away***", "***Home***"],
|
65 |
+
captions = ["Your team plays away.", "your team plays at home."])
|
66 |
+
if venue == '***Away***':
|
67 |
+
st.write('You selected Away.')
|
68 |
+
else:
|
69 |
+
st.write("You selected Home.")
|
70 |
+
team = st.selectbox("Your Team", unique_team)
|
71 |
+
opponent = st.selectbox("Your Opponent", unique_opponent)
|
72 |
+
|
73 |
+
clicked = st.form_submit_button("Predict Result")
|
74 |
+
if clicked:
|
75 |
+
result=model.predict(pd.DataFrame({"time": [time],
|
76 |
+
"comp": [comp],
|
77 |
+
"round": [EPL_DICT[round]],
|
78 |
+
"venue": [venue],
|
79 |
+
"team": [team],
|
80 |
+
"opponent": [opponent]}))
|
81 |
+
result = 'W' if result[0] == 1 else 'L'
|
82 |
+
st.success('The predicted result is {}'.format(result))
|
83 |
+
|
84 |
+
if __name__=='__main__':
|
85 |
+
main()
|
model.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7b1563f7b8a8b47182e109015f2644bd62965987413c32f962b1765a8df0f080
|
3 |
+
size 223643
|
unique_values.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a1170c08ecfcbb18fe25cb428ec0c5ca051a56cb9862c01716e05fb9800a206
|
3 |
+
size 3091
|