20
20
https://discuss.streamlit.io/t/any-way-to-prevent-commented-out-code-via-triple-quotes-to-be-displayed-in-streamlit/8821/6
21
21
22
22
This code takes heavy influece from a previous project.
23
- https://github.com/DerikVo/NN_hackathon
23
+ https://github.com/DerikVo/NN_hackathon/blob/main/Code/Helpers/streamlit/app.py
24
24
25
25
There were many changes to the code to get it to work with this data set as well as provide additional features,
26
26
but the general structure remains the same
@@ -44,6 +44,7 @@ def load_model_stream():
44
44
def get_prediction (model , image ):
45
45
open_image = Image .open (image )
46
46
resized_image = open_image .resize ((256 , 256 ))
47
+ # got help from chat gpt 3 by copy and pasting code and asking how get predictions from a single image
47
48
grayscale_image = resized_image .convert ('L' )
48
49
img = np .expand_dims (grayscale_image , axis = 0 )
49
50
predicted_prob = model .predict (img )[0 ]
@@ -81,6 +82,8 @@ def upload_mode():
81
82
this code also brows ideas from previous projects and intergrates it into a function.
82
83
Espically the model evaluation notebook.
83
84
'''
85
+
86
+ @st .cache_resource #cache so I can show this during presentation more easily
84
87
def model_Evaluation (path ):
85
88
'''
86
89
Calculate accuracy, precision, recall, and F1 score.
@@ -118,6 +121,7 @@ def model_Evaluation(path):
118
121
https://docs.streamlit.io/library/api-reference/media/st.image
119
122
'''
120
123
124
+
121
125
if page == 'Model Evaluation' :
122
126
path = ('../Models/CNN_base.h5' )
123
127
data = model_Evaluation (path )
0 commit comments