Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| import numpy as np | |
| import pickle | |
| with open('model_svr.pkl', 'rb') as file_6: | |
| model = pickle.load(file_6) | |
| def run(): | |
| with st.form("my_form"): | |
| nama = st.text_input('masukan nama player', value='nama') | |
| age = st.number_input('masukan usia player', min_value=15, max_value= 40, value=20) | |
| height = st.slider('Height',50, 250, 170) | |
| weight = st.number_input('Weight',50,100,70) | |
| price = st.number_input('Price',0,1000000,10000, help="Harga Pemain dalam euro " ) | |
| # Every form must have a submit button. | |
| 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('Pace',0,100,50) | |
| shoot = st.number_input('Shoot',0,100,50) | |
| passing = st.number_input('Passing',0,100,50) | |
| dribble = st.number_input('Dribble',0,100,50) | |
| defend = st.number_input('Defend',0,100,50) | |
| physicality = st.number_input('Physicality',0,100,50) | |
| 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': shoot, | |
| 'PassingTotal': passing, | |
| 'DribblingTotal': dribble, | |
| 'DefendingTotal': defend, | |
| 'PhysicalityTotal': physicality | |
| } | |
| data_inf = pd.DataFrame([data_inf]) | |
| if submitted: | |
| result= model.predict(data_inf) | |
| st.write(f'## Player Rating: {round(result[0])}') | |
| st.balloons() | |
| st.snow() | |
| if __name__ == '__main__': | |
| run() |