modified
Browse files
app.py
CHANGED
@@ -10,13 +10,28 @@ import os
|
|
10 |
import sklearn as sns
|
11 |
|
12 |
print(os.getcwd())
|
|
|
13 |
# Load dataset
|
14 |
@st.cache_data
|
15 |
def load_data():
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
df = load_data()
|
19 |
|
|
|
|
|
|
|
20 |
# Load machine learning models for prediction
|
21 |
model = joblib.load("random_forest.pkl")
|
22 |
model = joblib.load("logistic_regression.pkl")
|
|
|
10 |
import sklearn as sns
|
11 |
|
12 |
print(os.getcwd())
|
13 |
+
|
14 |
# Load dataset
|
15 |
@st.cache_data
|
16 |
def load_data():
|
17 |
+
file_path = "pokemon_cleaned.csv"
|
18 |
+
|
19 |
+
if not os.path.exists(file_path):
|
20 |
+
st.error(f"❌ File not found: {file_path}")
|
21 |
+
return None # Return None if file doesn't exist
|
22 |
+
|
23 |
+
try:
|
24 |
+
df = pd.read_csv(file_path)
|
25 |
+
return df
|
26 |
+
except Exception as e:
|
27 |
+
st.error(f"❌ Failed to load the CSV: {e}")
|
28 |
+
return None # Return None in case of an error
|
29 |
|
30 |
df = load_data()
|
31 |
|
32 |
+
if df is None:
|
33 |
+
st.stop()
|
34 |
+
|
35 |
# Load machine learning models for prediction
|
36 |
model = joblib.load("random_forest.pkl")
|
37 |
model = joblib.load("logistic_regression.pkl")
|