Commit
•
7c8b39a
1
Parent(s):
7d1ce2b
Updated lines 27-28 with: [notation] | Updated line 72 with: app title st.markdown("<h1 style='text-align: center; color: navy;'>Brain Tumor One Hot Encode TF Model</h1>", unsafe_allow_html=True)
Browse files
app.py
CHANGED
@@ -21,8 +21,12 @@ inv_class_mappings = {v: k for k, v in class_mappings.items()}
|
|
21 |
class_names = list(class_mappings.keys())
|
22 |
|
23 |
# Load the true and predicted labels
|
24 |
-
true_labels = np.load('true_labels.npy')
|
25 |
-
predicted_labels = np.load('predicted_labels.npy')
|
|
|
|
|
|
|
|
|
26 |
|
27 |
# Function to load and preprocess an image
|
28 |
def load_and_preprocess_image(image_path, image_shape=(168, 168)):
|
@@ -64,6 +68,9 @@ predictions = [model.predict(image) for image in images]
|
|
64 |
# Determine the predicted labels
|
65 |
predicted_labels = [inv_class_mappings[np.argmax(one_hot)] for one_hot in predictions]
|
66 |
|
|
|
|
|
|
|
67 |
# Output the predictions
|
68 |
st.write(f'Class Mappings: {class_mappings}')
|
69 |
st.write("\nNormal Image Prediction:", np.round(predictions[0], 3)[0])
|
|
|
21 |
class_names = list(class_mappings.keys())
|
22 |
|
23 |
# Load the true and predicted labels
|
24 |
+
true_labels = np.load('true_labels.npy') # Model trained on Brain Tumor MRI Dataset
|
25 |
+
predicted_labels = np.load('predicted_labels.npy') # Model foments predictions based upon the training/testing of the Brain Tumor MRI Dataset
|
26 |
+
|
27 |
+
# Note0: The One Hot Encode Predictions are leveraging the TF CNN Model's training/testing of the Brain Tumor MRI Dataset
|
28 |
+
# Note1: The One Hot Encode Predictions are deriving from another dataset -> Crystal Clean: Brain Tumors MRI Dataset
|
29 |
+
|
30 |
|
31 |
# Function to load and preprocess an image
|
32 |
def load_and_preprocess_image(image_path, image_shape=(168, 168)):
|
|
|
68 |
# Determine the predicted labels
|
69 |
predicted_labels = [inv_class_mappings[np.argmax(one_hot)] for one_hot in predictions]
|
70 |
|
71 |
+
# Create Streamlit app title
|
72 |
+
st.markdown("<h1 style='text-align: center; color: navy;'>Brain Tumor One Hot Encode TF Model</h1>", unsafe_allow_html=True)
|
73 |
+
|
74 |
# Output the predictions
|
75 |
st.write(f'Class Mappings: {class_mappings}')
|
76 |
st.write("\nNormal Image Prediction:", np.round(predictions[0], 3)[0])
|