To start with, try to detect the main habitat of small gnats. Usually this is the kitchen or pantry. This phenomenon was the fact that fruit flies (gnats) appear in areas of decaying plant substance, it it they eat (potatoes, pears, apples, jam, etc.). You should immediately inspect and repair the alleged objects and sources of their breeding habitat. Also note: in addition to food, small black flies can be found in the bathroom, where the source of their occurrence can serve as a Bank with some chemical.
Be sure to clean the drain holes in the sinks and tub. Often remnants of food stuck there, gradually begin to rot, attracting such insects. The nearest supermarket to purchase a special chemical agent to remove insects (including midges), through which you for a few minutes will resolve the problem.
After the elimination of the main source of propagation of small midges, it is necessary to eliminate the remaining inhabitants. You can use the ordinary chemical means (against insects) or to build their own trap. The last method is most suitable for rooms where Pets or children. For traps you will need: a plastic Cup, adhesive tape (wide tape), a hook. In a disposable plastic Cup to put the bait (banana, nectarine, peach, compote or juice). Drag it on top of wide tape or duct tape (sticky side inwards). Do the thick needle holes in the film. Now, put the trap where you notice the presence of midges. If necessary, the procedure can be repeated.
Guide preventive measures, warning the appearance of small black flies. Make General cleaning in the apartment. Try not to leave dirty dishes at night, always remove leftover food in the fridge. Regularly iterate vegetables and fruit for rotten food. Observing cleanliness in the apartment, you will avoid the appearance of small black flies.