| import numpy as np | |
| import tensorflow as tf | |
| class Prediction: | |
| def predict_image(self, model, img): | |
| img = tf.image.decode_jpeg(img, channels=3) | |
| resize = tf.image.resize(img, (224,224)) | |
| yhat = model.predict(np.expand_dims(resize/255, 0)) | |
| max_index = np.argmax(yhat) | |
| print(yhat) | |
| op_d = {0:'Cyst',1:'Normal',2:'Stone',3:'Tumor'} | |
| return op_d[max_index] | |