Could Diatomaceous Earth Prevent Gnats?

I am growing indoor hydroponic jalapeno peppers and have a problem with mostly gnats. I need to reduce / eliminate the gnats hovering over my potted plants.
I pot my plants in gallon pots filled with hydrocorn. I feed them with drip feed irragtion spikes.
Would som D.E. thrown on top of the hydrocorn in the gallon pots prevent these gnats from breeding in the clay pebbles? If so, which kind of D.E. should be used? Horticultural or food grade?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
Add image file
Upload is a website for homeowners and building and maintenance pros. It is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.