Update src/streamlit_app.py
Browse files9 unmodified lines101112131314151617181920212223242526272829303132333435363738391819402122232425414243449 unmodified lines
# ========== Load Model ========== MODEL_PATH = os.path.join("models", "model.h5") # No ".." needed anymoreMODEL_PATH = os.path.join("models", "model.h5") # This is the current correct path
# --- Debugging Lines ---st.write(f"Current working directory: {os.getcwd()}")st.write(f"Absolute path being checked: {os.path.abspath(MODEL_PATH)}")
# List contents of the current working directorytry: st.write(f"Contents of CWD ({os.getcwd()}): {os.listdir(os.getcwd())}")except Exception as e: st.write(f"Error listing CWD: {e}")
# List contents of the 'models' directory if it existsmodels_dir_abs = os.path.join(os.getcwd(), "models")st.write(f"Does 'models' directory exist at {models_dir_abs}: {os.path.exists(models_dir_abs)}")if os.path.exists(models_dir_abs): try: st.write(f"Contents of 'models' directory: {os.listdir(models_dir_abs)}") except Exception as e: st.write(f"Error listing 'models' directory: {e}")else: st.write("The 'models' directory itself was not found in CWD.")# --- End Debugging Lines ---
if not os.path.exists(MODEL_PATH): st.error(f"Model file not found at: {MODEL_PATH}") st.stop() model = tf.keras.models.load_model(MODEL_PATH)
if not os.path.exists(MODEL_PATH): st.error(f"❌ Model file not found at: {MODEL_PATH}") st.stop()else: model = tf.keras.models.load_model(MODEL_PATH)model = tf.keras.models.load_model(MODEL_PATH)
# ========== Class Labels ==========# Replace with your actual class names if neededsrc/streamlit_app.py+24-8