I haven't done this yet, but you can use tensorflow.js and one of the many pretrained Models that are available for it (e.g. "vgg16") . This Vgg16 model was trained on a database of ~10 million Images, and certainly there are lots of flowers among these. (This image collection is called IMAGENET by the way)
Then you can use that Vgg16 model file (it's a small binary file, in HGF5 format) and feed it your photograph, and it will come up with ("predict") a label for that photograph. e.g "flower".
You can customize this output, in principle, with your own code, such that tensorflow.js only reports "purple flowers" as success, but that is more advanced material.
Here is a blogpost with two videos of a guy who has done something similar:
I haven't watched these videos in full , but according to the text of the blog post and the embedded file "predict.js" it could be similar to what you want to accomplish.