Spaces:
Sleeping
Sleeping
219x5a05k4gprecacin
commited on
Commit
•
c72564c
1
Parent(s):
845b8d5
Update app.py
Browse files
app.py
CHANGED
@@ -7,14 +7,14 @@ from tensorflow.keras.preprocessing import image
|
|
7 |
from keras.preprocessing.image import img_to_array
|
8 |
from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2,preprocess_input as mobilenet_v2_preprocess_input
|
9 |
|
10 |
-
|
11 |
resnet = tf.keras.models.load_model("saved_model/resnet_brain_model_9_11.h5")
|
12 |
vgg = tf.keras.models.load_model("saved_model/vgg_brain_model_9_11.h5")
|
13 |
|
14 |
### load file
|
15 |
uploaded_file = st.file_uploader("Choose a image file", type="jpg")
|
16 |
|
17 |
-
map_dict = {0: '
|
18 |
1: 'glioma',
|
19 |
2: 'healthy',
|
20 |
3: 'meningioma',
|
@@ -40,7 +40,7 @@ if uploaded_file is not None:
|
|
40 |
|
41 |
Genrate_pred = st.button("Generate Prediction")
|
42 |
if Genrate_pred:
|
43 |
-
prediction =
|
44 |
st.title("Predicted Label for the image by cnn model is {}".format(map_dict [prediction]))
|
45 |
prediction = resnet.predict(img[0]).argmax()
|
46 |
st.title("Predicted Label for the image by resnet model is {}".format(map_dict [prediction]))
|
|
|
7 |
from keras.preprocessing.image import img_to_array
|
8 |
from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2,preprocess_input as mobilenet_v2_preprocess_input
|
9 |
|
10 |
+
cnn = tf.keras.models.load_model("saved_model/cnn_brain_model_9_11.h5")
|
11 |
resnet = tf.keras.models.load_model("saved_model/resnet_brain_model_9_11.h5")
|
12 |
vgg = tf.keras.models.load_model("saved_model/vgg_brain_model_9_11.h5")
|
13 |
|
14 |
### load file
|
15 |
uploaded_file = st.file_uploader("Choose a image file", type="jpg")
|
16 |
|
17 |
+
map_dict = {0: 'demented',
|
18 |
1: 'glioma',
|
19 |
2: 'healthy',
|
20 |
3: 'meningioma',
|
|
|
40 |
|
41 |
Genrate_pred = st.button("Generate Prediction")
|
42 |
if Genrate_pred:
|
43 |
+
prediction = cnn.predict(img[0]).argmax()
|
44 |
st.title("Predicted Label for the image by cnn model is {}".format(map_dict [prediction]))
|
45 |
prediction = resnet.predict(img[0]).argmax()
|
46 |
st.title("Predicted Label for the image by resnet model is {}".format(map_dict [prediction]))
|