Spaces:
Sleeping
Sleeping
File size: 1,876 Bytes
9a005e8 |
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 |
import pandas as pd
import numpy as np
import pickle
import json
import streamlit as st
with open('model_svr.pkl', 'rb') as file_6:
model = pickle.load(file_6)
with st.form("my_form"):
st.write("Inside the form")
nama = st.text_input('masukan nama player',value='nama', help= 'disini masukan nama player')
age = st.number_input('masukan usia player', min_value=15, max_value=100)
height = st.slider('Height', 50,250,170)
weight = st.slider('Weight', 50,100,170)
price = st.number_input('Price', 0,1000000,10000)
st.write('-'*50)
attack = st.selectbox('Attacking Work Rate', ['Low', 'Medium', 'High'], index=1)
defense = st.radio('Defensive Work Rate', ['Low', 'Medium', 'High'], index=1)
st.markdown('---')
pace = st.number_input('PaceTotal', 0,100,100)
shooting = st.number_input('ShootingTotal', 0,100,100)
passing = st.number_input('PassingTotal', 0,100,100)
dribbling = st.number_input('DribblingTotal', 0,100,100)
defending = st.number_input('DefendingTotal', 0,100,100)
physicality = st.number_input('PhysicalityTotal', 0,100,100)
# Every form must have a submit button.
submitted = st.form_submit_button("Submit")
st.write("Outside the form")
data_inf = {
'Name': nama,
'Age' : age,
'Height' : height,
'Weight' : weight,
'Price' : price,
'AttackingWorkRate': attack,
'DefensiveWorkRate': defense,
'PaceTotal': pace,
'ShootingTotal': shooting,
'PassingTotal': passing,
'DribblingTotal': dribbling,
'DefendingTotal': defending,
'PhysicalityTotal': physicality
}
data_inf = pd.DataFrame([data_inf])
data_inf
if submitted:
result= model.predict(data_inf)
st.write(f'## Player Rating: {round(result[0])}')
st.balloons()
st.snow()
if __name__ =='__main__':
data_inf() |