forked from akmadan/simple_streamlit_app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
45 lines (39 loc) · 1.25 KB
/
app.py
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
import streamlit as st
import pickle
import sklearn
import pandas as pd
import numpy as np
from PIL import Image
model = pickle.load(open('model.sav', 'rb'))
st.title('Player Salary Prediction')
st.sidebar.header('Player Data')
image = Image.open('bb.jpg')
st.image(image, '')
# FUNCTION
def user_report():
rating = st.sidebar.slider('Rating', 50,100, 1 )
jersey = st.sidebar.slider('Jersey', 0,100, 1 )
team = st.sidebar.slider('Team', 0,30, 1 )
position = st.sidebar.slider('Position', 0,10, 1 )
country = st.sidebar.slider('Country', 0,3, 1 )
draft_year = st.sidebar.slider('Draft Year', 2000,2020, 2000)
draft_round = st.sidebar.slider('Draft Round', 1,10, 1)
draft_peak = st.sidebar.slider('Draft Peak', 1,30, 1)
user_report_data = {
'rating':rating,
'jersey':jersey,
'team':team,
'position':position,
'country':country,
'draft_year':draft_year,
'draft_round':draft_round,
'draft_peak':draft_peak
}
report_data = pd.DataFrame(user_report_data, index=[0])
return report_data
user_data = user_report()
st.header('Player Data')
st.write(user_data)
salary = model.predict(user_data)
st.subheader('Player Salary')
st.subheader('$'+str(np.round(salary[0], 2)))