This is what I do. Simple, cheap, and non toxic.
Take a jar or glass. I used an empty jar and clean it out. Put about a half cup of apple cider vinegar in it. Stretch saran wrap over the mouth of the jar. Use a toothpick to poke holes in the top. They have to be big enough for the gnat to crawl into. Secure with a rubber band. Set it on the counter in the kitchen or wherever the gnats persist. You could do one in the bath, one in the kitchen, etc.
The gnats are drawn to the cider vinegar and will crawl into the jar but won't be able to get out and will drown. Works like a charm. Leave it in place until you don't see any more gnats.
Dale