Spaces:
Sleeping
Sleeping
Harshitaraina
commited on
Commit
•
41034c3
1
Parent(s):
5a46a6a
Upload 8 files
Browse files- README.md +1 -12
- app.py +96 -0
- dataextractandclean.ipynb +0 -0
- dataset_level1.pkl +3 -0
- dataset_level2.pkl +3 -0
- featureextractandmodels.ipynb +0 -0
- model.pkl +3 -0
- requirements.txt +8 -0
README.md
CHANGED
@@ -1,12 +1 @@
|
|
1 |
-
|
2 |
-
title: Echoscore
|
3 |
-
emoji: 🏢
|
4 |
-
colorFrom: purple
|
5 |
-
colorTo: indigo
|
6 |
-
sdk: streamlit
|
7 |
-
sdk_version: 1.36.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
# echoscore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pickle
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
model = pickle.load(open("model.pkl", "rb"))
|
7 |
+
|
8 |
+
teams=[
|
9 |
+
'Australia',
|
10 |
+
'India',
|
11 |
+
'Bangladesh',
|
12 |
+
'New Zealand',
|
13 |
+
'South Africa',
|
14 |
+
'England',
|
15 |
+
'Afghanistan',
|
16 |
+
'Pakistan',
|
17 |
+
'Sri Lanka',
|
18 |
+
'Netherlands']
|
19 |
+
|
20 |
+
|
21 |
+
st.title('Cricket Score Predictor')
|
22 |
+
col1, col2 = st.columns(2)
|
23 |
+
|
24 |
+
with col1:
|
25 |
+
batting_team = st.selectbox('Select batting team', sorted(teams))
|
26 |
+
with col2:
|
27 |
+
bowling_team = st.selectbox('Select bowling team', sorted(teams))
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
col3,col4,col5 = st.columns(3)
|
32 |
+
|
33 |
+
with col3:
|
34 |
+
current_score = st.number_input('Current Score')
|
35 |
+
with col4:
|
36 |
+
overs = st.number_input('Overs done(works for over>5)')
|
37 |
+
with col5:
|
38 |
+
wickets = st.number_input('Wickets out')
|
39 |
+
|
40 |
+
last_five_runs = st.number_input('Runs scored in last 5 overs')
|
41 |
+
|
42 |
+
if st.button('Predict Score'):
|
43 |
+
balls_left = 300 - (overs*6)
|
44 |
+
wickets_left = 10 -wickets
|
45 |
+
crr = current_score/overs
|
46 |
+
if batting_team == 'Australia':
|
47 |
+
batting_team = 1
|
48 |
+
if batting_team == 'India':
|
49 |
+
batting_team = 4
|
50 |
+
if batting_team == 'Bangladesh':
|
51 |
+
batting_team = 2
|
52 |
+
if batting_team == 'New Zealand':
|
53 |
+
batting_team = 6
|
54 |
+
if batting_team == 'South Africa':
|
55 |
+
batting_team = 8
|
56 |
+
if batting_team == 'England':
|
57 |
+
batting_team = 3
|
58 |
+
if batting_team == 'Afghanistan':
|
59 |
+
batting_team = 0
|
60 |
+
if batting_team == 'Pakistan':
|
61 |
+
batting_team = 7
|
62 |
+
if batting_team == 'Sri Lanka':
|
63 |
+
batting_team = 9
|
64 |
+
if batting_team == 'Netherlands':
|
65 |
+
batting_team = 5
|
66 |
+
if bowling_team == 'Australia':
|
67 |
+
bowling_team = 1
|
68 |
+
if bowling_team == 'India':
|
69 |
+
bowling_team = 4
|
70 |
+
if bowling_team == 'Bangladesh':
|
71 |
+
bowling_team = 2
|
72 |
+
if bowling_team == 'New Zealand':
|
73 |
+
bowling_team = 6
|
74 |
+
if bowling_team == 'South Africa':
|
75 |
+
bowling_team = 8
|
76 |
+
if bowling_team == 'England':
|
77 |
+
bowling_team = 3
|
78 |
+
if bowling_team == 'Afghanistan':
|
79 |
+
bowling_team = 0
|
80 |
+
if bowling_team == 'Pakistan':
|
81 |
+
bowling_team = 7
|
82 |
+
if bowling_team == 'Sri Lanka':
|
83 |
+
bowling_team = 9
|
84 |
+
if bowling_team == 'Netherlands':
|
85 |
+
bowling_team = 5
|
86 |
+
|
87 |
+
|
88 |
+
features = [[batting_team, bowling_team, overs, current_score, balls_left, wickets, crr,
|
89 |
+
last_five_runs]]
|
90 |
+
|
91 |
+
# Make a prediction
|
92 |
+
prediction = model.predict(features)
|
93 |
+
|
94 |
+
# Display the prediction result
|
95 |
+
st.write(f"Predicted Total Score: {int(prediction[0])}")
|
96 |
+
|
dataextractandclean.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
dataset_level1.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d0adcf9bd7a464efc13066b92a7149664d35e9d0a73933655ebab311be1e9dde
|
3 |
+
size 131022134
|
dataset_level2.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e98232543b8b37b7c5d58ac39420b8db3977610d4cfa2d7068b3e3940e7141c
|
3 |
+
size 18003255
|
featureextractandmodels.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7977cc5047d1617764ca5dc7b1fb258b6f154599fab2d7e4a36b7f2ae513c905
|
3 |
+
size 573722869
|
requirements.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit==1.28.2
|
2 |
+
scikit-learn==1.3.2
|
3 |
+
pandas==2.1.3
|
4 |
+
numpy==1.26.2
|
5 |
+
pyyaml
|
6 |
+
tqdm
|
7 |
+
xgboost
|
8 |
+
matplotlib
|