File size: 424 Bytes
f9b62aa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
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]
|