Skip to content

Instantly share code, notes, and snippets.

@Karts27
Last active November 16, 2021 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Karts27/b22c1097c8c180ec239a06187718bf13 to your computer and use it in GitHub Desktop.
Save Karts27/b22c1097c8c180ec239a06187718bf13 to your computer and use it in GitHub Desktop.
def predict(img_path, model):
image = load_img(img_path)
image = image.resize((64,64))
image = img_to_array(image)
image = np.expand_dims(image, axis = 0)
pred = model.predict(image)
#print(pred)
pred = np.argmax(pred)
if pred == 0:
return 'daisy'
elif pred == 1:
return "dandelion"
elif pred == 2:
return "rose"
else:
return "sunflower"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment