Skip to content

Commit 9e81125

Browse files
authored
Merge pull request larymak#235 from Vinayak119A/contribute
added cricket score predictor project
2 parents 48406ed + 379f6e1 commit 9e81125

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Cricket score predictor
2+
3+
This is a machine learning based project built with python and a model that's been trained specifically to predict cricket scores of upcoming matches with as much canonicity and
4+
accuracy possible.
5+
6+
Here's a demonstration snapshot of our project.
7+
8+
![MicrosoftTeams-image](https://user-images.githubusercontent.com/113302353/198577345-949da015-15cb-4dab-9cdc-6ad4a9f0bb3d.png)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import streamlit as st
2+
import pickle
3+
import pandas as pd
4+
import numpy as np
5+
6+
pipe = pickle.load(open('pipe.pkl','rb'))
7+
8+
teams = ['Australia',
9+
'India',
10+
'Bangladesh',
11+
'New Zealand',
12+
'South Africa',
13+
'England',
14+
'West Indies',
15+
'Afghanistan',
16+
'Pakistan',
17+
'Sri Lanka']
18+
19+
cities = ['Colombo',
20+
'Mirpur',
21+
'Johannesburg',
22+
'Dubai',
23+
'Auckland',
24+
'Cape Town',
25+
'London',
26+
'Pallekele',
27+
'Barbados',
28+
'Sydney',
29+
'Melbourne',
30+
'Durban',
31+
'St Lucia',
32+
'Wellington',
33+
'Lauderhill',
34+
'Hamilton',
35+
'Centurion',
36+
'Manchester',
37+
'Abu Dhabi',
38+
'Mumbai',
39+
'Nottingham',
40+
'Southampton',
41+
'Mount Maunganui',
42+
'Chittagong',
43+
'Kolkata',
44+
'Lahore',
45+
'Delhi',
46+
'Nagpur',
47+
'Chandigarh',
48+
'Adelaide',
49+
'Bangalore',
50+
'St Kitts',
51+
'Cardiff',
52+
'Christchurch',
53+
'Trinidad']
54+
55+
st.title('Cricket Score Predictor')
56+
57+
col1, col2 = st.columns(2)
58+
59+
with col1:
60+
batting_team = st.selectbox('Select batting team',sorted(teams))
61+
with col2:
62+
bowling_team = st.selectbox('Select bowling team', sorted(teams))
63+
64+
city = st.selectbox('Select city',sorted(cities))
65+
66+
col3,col4,col5 = st.columns(3)
67+
68+
with col3:
69+
current_score = st.number_input('Current Score')
70+
with col4:
71+
overs = st.number_input('Overs done(works for over>5)')
72+
with col5:
73+
wickets = st.number_input('Wickets out')
74+
75+
last_five = st.number_input('Runs scored in last 5 overs')
76+
77+
if st.button('Predict Score'):
78+
balls_left = 120 - (overs * 6)
79+
wickets_left = 10 - wickets
80+
crr = current_score / overs
81+
82+
input_df = pd.DataFrame(
83+
{'batting_team': [batting_team], 'bowling_team': [bowling_team], 'city': city, 'current_score': [current_score],
84+
'balls_left': [balls_left], 'wickets_left': [wickets], 'crr': [crr], 'last_five': [last_five]})
85+
result = pipe.predict(input_df)
86+
st.header("Predicted Score - " + str(int(result[0])))
Binary file not shown.

0 commit comments

Comments
 (0)