Added files for the app
Browse files- .gitignore +1 -0
- app.py +75 -0
- pokemon data/logistic_regression.pkl +3 -0
- pokemon data/naive_bayes.pkl +3 -0
- pokemon data/pokemon_cleaned.csv +0 -0
- pokemon data/random_forest.pkl +3 -0
- requirements.txt +5 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.venv/
|
app.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Pokemon Explorer is an interactive Streamlit app for exploring Pokémon data!
|
2 |
+
# Easily browse Pokémon stats, visualize and predict attributes, and filter by type or name.
|
3 |
+
|
4 |
+
import streamlit as st
|
5 |
+
import pandas as pd
|
6 |
+
import joblib
|
7 |
+
import matplotlib.pyplot as plt
|
8 |
+
import seaborn as sns
|
9 |
+
|
10 |
+
# Load dataset
|
11 |
+
@st.cache_data
|
12 |
+
def load_data():
|
13 |
+
return pd.read_csv(r"C:\Users\ACER\Desktop\Feature_Prediction_of_Pokemon\pokemon data\pokemon_cleaned.csv")
|
14 |
+
|
15 |
+
df = load_data()
|
16 |
+
|
17 |
+
# Load machine learning models (if any)
|
18 |
+
model = joblib.load(r"C:\Users\ACER\Desktop\Feature_Prediction_of_Pokemon\pokemon data\random_forest.pkl") # Uncomment if using a model
|
19 |
+
|
20 |
+
# Sidebar Navigation
|
21 |
+
st.sidebar.title("🔍 Pokémon Explorer")
|
22 |
+
st.sidebar.markdown("Navigate through different sections!")
|
23 |
+
page = st.sidebar.radio(" Select a Page", ["Home", "Data Overview", "Visualization and Prediction"])
|
24 |
+
|
25 |
+
# Home Page
|
26 |
+
if page == "Home":
|
27 |
+
st.title("Pokémon Explorer")
|
28 |
+
st.markdown("Explore Pokémon stats, types, and visualizations interactively! ")
|
29 |
+
st.markdown("### Features:")
|
30 |
+
st.write("✔️ Browse Pokémon data")
|
31 |
+
st.write("✔️ Visualize Pokémon stats")
|
32 |
+
st.write("✔️ Search and filter Pokémon")
|
33 |
+
st.write("✔️ Predict Pokémon attributes")
|
34 |
+
|
35 |
+
# Data Overview Page
|
36 |
+
elif page == "Data Overview":
|
37 |
+
st.title("Pokémon Data Overview")
|
38 |
+
st.write("Browse and explore the Pokémon dataset.")
|
39 |
+
|
40 |
+
name_search = st.text_input("🔍 Search Pokémon by Name")
|
41 |
+
type_filter = st.selectbox("🎨 Filter by Type", ["All"] + sorted(df['Type 1'].unique().tolist()))
|
42 |
+
|
43 |
+
filtered_df = df
|
44 |
+
if name_search:
|
45 |
+
filtered_df = filtered_df[filtered_df['Name'].str.contains(name_search, case=False, na=False)]
|
46 |
+
if type_filter != "All":
|
47 |
+
filtered_df = filtered_df[filtered_df['Type 1'] == type_filter]
|
48 |
+
|
49 |
+
st.dataframe(filtered_df, use_container_width=True)
|
50 |
+
|
51 |
+
# Visualization and Prediction Page
|
52 |
+
elif page == "Visualization and Prediction":
|
53 |
+
st.title(" Pokémon Data Visualization and Prediction")
|
54 |
+
st.write("Explore Pokémon stats with interactive graphs!")
|
55 |
+
|
56 |
+
pokemon_list = df['Name'].unique().tolist()
|
57 |
+
selected_pokemon_name = st.selectbox("🔍 Select a Pokémon", pokemon_list)
|
58 |
+
selected_pokemon = df[df['Name'] == selected_pokemon_name]
|
59 |
+
|
60 |
+
if not selected_pokemon.empty:
|
61 |
+
st.write(f"### {selected_pokemon.iloc[0]['Name']}")
|
62 |
+
st.write(f"**Type:** {selected_pokemon.iloc[0]['Type 1']} / {selected_pokemon.iloc[0].get('Type 2', 'None')}")
|
63 |
+
st.write(f"**Legendary:** {'Yes' if selected_pokemon.iloc[0]['Legendary'] else 'No'}")
|
64 |
+
st.write(f"**Generation:** {selected_pokemon.iloc[0]['Generation']}")
|
65 |
+
|
66 |
+
stats = ["HP", "Attack", "Defense", "Speed"]
|
67 |
+
fig, ax = plt.subplots(figsize=(8, 5))
|
68 |
+
sns.barplot(x=stats, y=selected_pokemon.iloc[0][stats].values, ax=ax)
|
69 |
+
ax.set_xlabel("Stats")
|
70 |
+
ax.set_ylabel("Value")
|
71 |
+
ax.set_title(f"Stat Distribution for {selected_pokemon.iloc[0]['Name']}")
|
72 |
+
st.pyplot(fig)
|
73 |
+
|
74 |
+
st.sidebar.markdown("---")
|
75 |
+
st.sidebar.write("✨ Made by CI-DAVE")
|
pokemon data/logistic_regression.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e76cc9d145ca63b9089cabf933a4ae720bd75732227fbc51f068c3d5260a699
|
3 |
+
size 1416
|
pokemon data/naive_bayes.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:99c960e2153135fbc2d597321baa8515e47b0b5b926473a83fca48be7dbcd19e
|
3 |
+
size 1586
|
pokemon data/pokemon_cleaned.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pokemon data/random_forest.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a98cba74842b09cdb19fee3ec2df2fac9bf1072521445e9fee05c92f327039a
|
3 |
+
size 1106515
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
pandas
|
3 |
+
joblib
|
4 |
+
matplotlib
|
5 |
+
seaborn
|