Update prediction.py
Browse files- prediction.py +4 -4
prediction.py
CHANGED
@@ -14,9 +14,9 @@ import pickle
|
|
14 |
|
15 |
#load model
|
16 |
def run():
|
17 |
-
file = st.file_uploader("Upload an image", type=["jpg", "png"])
|
18 |
|
19 |
-
model = load_model('
|
20 |
target_size=(224, 224)
|
21 |
|
22 |
def import_and_predict(image_data, model):
|
@@ -32,9 +32,9 @@ def run():
|
|
32 |
classes = model.predict(x)
|
33 |
result_pred = np.where(classes < 0.7, 0, 1)
|
34 |
if result_pred == 1:
|
35 |
-
result = '
|
36 |
else:
|
37 |
-
result = '
|
38 |
|
39 |
return f"Prediction: {result}"
|
40 |
|
|
|
14 |
|
15 |
#load model
|
16 |
def run():
|
17 |
+
file = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
|
18 |
|
19 |
+
model = load_model('model_tl.h5', custom_objects={'KerasLayer': hub.KerasLayer})
|
20 |
target_size=(224, 224)
|
21 |
|
22 |
def import_and_predict(image_data, model):
|
|
|
32 |
classes = model.predict(x)
|
33 |
result_pred = np.where(classes < 0.7, 0, 1)
|
34 |
if result_pred == 1:
|
35 |
+
result = 'Pneumonia'
|
36 |
else:
|
37 |
+
result = 'Normal'
|
38 |
|
39 |
return f"Prediction: {result}"
|
40 |
|