MHuzaifaa commited on
Commit
c2eba4e
·
verified ·
1 Parent(s): 0269a24

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +3 -3
src/app.py CHANGED
@@ -133,7 +133,7 @@ st.markdown("""
133
  """, unsafe_allow_html=True)
134
 
135
  # Load Resources
136
- @st.cache_resourcedef load_resources():
137
  # CHANGE: Remove '../' because 'models' is now a subdirectory of 'src'
138
  models_dir = os.path.join(os.path.dirname(__file__), 'models')
139
  model_path = os.path.join(models_dir, 'best_model.pkl')
@@ -148,7 +148,7 @@ st.markdown("""
148
  kmeans = joblib.load(kmeans_path)
149
  return model, encoders, kmeans
150
 
151
- @st.cache_resourcedef load_new_artifacts():
152
  try:
153
  # CHANGE: Remove '../'
154
  models_dir = os.path.join(os.path.dirname(__file__), 'models')
@@ -159,7 +159,7 @@ st.markdown("""
159
  st.error(f"❌ Artifact loading error: {e}")
160
  return None
161
 
162
- @st.cache_datadef load_data_sample():
163
  # CHANGE: Keep '../' to go up to the root, then look for 'data'
164
  data_dir = os.path.join(os.path.dirname(__file__), '../data/crimedataset')
165
  try:
 
133
  """, unsafe_allow_html=True)
134
 
135
  # Load Resources
136
+ @st.cache_resource def load_resources():
137
  # CHANGE: Remove '../' because 'models' is now a subdirectory of 'src'
138
  models_dir = os.path.join(os.path.dirname(__file__), 'models')
139
  model_path = os.path.join(models_dir, 'best_model.pkl')
 
148
  kmeans = joblib.load(kmeans_path)
149
  return model, encoders, kmeans
150
 
151
+ @st.cache_resource def load_new_artifacts():
152
  try:
153
  # CHANGE: Remove '../'
154
  models_dir = os.path.join(os.path.dirname(__file__), 'models')
 
159
  st.error(f"❌ Artifact loading error: {e}")
160
  return None
161
 
162
+ @st.cache_data def load_data_sample():
163
  # CHANGE: Keep '../' to go up to the root, then look for 'data'
164
  data_dir = os.path.join(os.path.dirname(__file__), '../data/crimedataset')
165
  try: