Massive multiple-input multiple-output (MIMO) is a key technology in 5G. It enables multiple users to be served in the same time-frequency block through precoding or beamforming techniques, thus increasing capacity, reliability and energy efficiency. A key issue in massive MIMO is the allocation of power to the individual antennas, in order to achieve a specific objective, e.g., the maximization of the minimum capacity guaranteed to each user. This is a nondeterministic polynomial (NP)-hard problem that needs to be solved in a timely manner since the state of the channels evolves in time and the power allocation should stay in tune with this state. Although several heuristics have been proposed to solve this problem, these entail a considerable time-complexity. As a result, with the present methods, it cannot be guaranteed that power allocation happens in time. To solve this problem, we propose a deep neural network (DNN). A DNN has a low time complexity, but requires an extensive, offline, training process before it becomes operational. The DNN we propose is the combination of two convolutional layers and four fully connected layers. It takes as input the long-term fading information and it outputs the power for each antenna element to each user. We limit ourselves to the case of time-division duplex (TDD) based sub-6GHz networks. Numerical results show that, our DNN-based method approximates very closely the results of a commonly used heuristic based on the bisection algorithm.INDEX TERMS Cell-free massive MIMO, deep learning, power allocation.