|
import streamlit as st |
|
import numpy as np |
|
import pickle |
|
from tensorflow.keras.models import load_model |
|
|
|
|
|
@st.cache_resource() |
|
def load_h5_model(model_path): |
|
return load_model(model_path) |
|
|
|
|
|
@st.cache_resource() |
|
def load_npy_data(data_path): |
|
return np.load(data_path) |
|
|
|
|
|
@st.cache_resource() |
|
def load_pkl_file(pkl_path): |
|
with open(pkl_path, 'rb') as f: |
|
return pickle.load(f) |
|
|
|
|
|
def main(): |
|
st.title("Breast Cancer Detection Model Evaluation") |
|
|
|
|
|
model = load_h5_model('CNN_model.h5') |
|
|
|
|
|
X_test = load_npy_data('X_test.npy') |
|
y_test = load_npy_data('y_test.npy') |
|
|
|
|
|
loaded_correct_predictions, loaded_correct_indices = load_pkl_file('accuracy_epoch_5000.pkl') |
|
|
|
|
|
history = load_pkl_file('history.pkl') |
|
|
|
|
|
st.write("X_test shape:", X_test.shape) |
|
st.write("y_test shape:", y_test.shape) |
|
|
|
|
|
st.write("CNN_model.h5 Summary") |
|
st.text(model.summary()) |
|
|
|
|
|
st.write("accuracy_epoch_5000 results:") |
|
st.write("Loaded Correct Predictions:", loaded_correct_predictions) |
|
st.write("Loaded Correct Indices:", loaded_correct_indices) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st.write("Breast Cancer Detection Model Accuracy deriving from history:") |
|
if 'accuracy' in history: |
|
st.line_chart(history['accuracy']) |
|
else: |
|
st.write("No accuracy data available in history.") |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|