sgp3 / Prediction.py
yashpat85's picture
Upload 3 files
f9b62aa verified
raw
history blame contribute delete
424 Bytes
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]