File size: 752 Bytes
05f7b3b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import numpy as np
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing import image
import os
class Prediction:
def __init__(self,filename):
self.filename =filename
def predict(self):
# load model
model = load_model("model.h5")
imagename = self.filename
test_image = image.load_img(imagename, target_size = (224,224))
test_image = image.img_to_array(test_image)
test_image = np.expand_dims(test_image, axis = 0)
result = np.argmax(model.predict(test_image), axis=1)
print(result)
if result[0] == 1:
prediction = 'Healthy'
else:
prediction = 'Coccidiosis'
return prediction |