Spaces:
Runtime error
Runtime error
File size: 1,015 Bytes
a3c4049 9e05224 a3c4049 |
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 |
import streamlit as st
import pickle
import numpy as np
from sklearn.tree import DecisionTreeRegressor
def load_model():
with open('saved_data.pkl', 'rb') as file:
data = pickle.load(file)
return data
data = load_model()
regressor = data["model"]
torf = (
"True",
"False",
)
def show_predict_page():
st.title("Pokemon Attack Prediction Based on Other Stats")
st.write(""" ### Enter your pokemon's stats to get the predicted attack stat""")
total_points = st.slider("total points", 0, 720, 350)
HP = st.slider("Health Points", 0, 255, 120)
Defense = st.slider("Defense", 0, 230, 50)
Generation = st.slider("Generation", 1, 6, 1)
Legendary = st.selectbox("Is Legendary", torf)
ok = st.button("Calculate Attack")
if ok:
X = np.array([[total_points, HP, Defense, Generation, int(bool(Legendary))]])
X = X.astype(int)
attack = regressor.predict(X)
st.subheader(f"YOUR POKEMON'S ESTIMATED ATTACK IS {attack[0]}")
|