The galactic habitable zone is defined as the region with sufficient abundance of heavy elements to form planetary systems in which Earth-like planets could be born and might be capable of sustaining life, after surviving to close supernova explosion events. Galactic chemical evolution models can be useful for studying the galactic habitable zones in different systems. We apply detailed chemical evolution models including radial gas flows to find the galactic habitable zones in our Galaxy and M31. We compare the results to the relative galactic habitable zones found with "classical" models, where no gas inflows were included. For both the Milky Way and Andromeda, the main effect of the gas radial inflows is to enhance the number of stars hosting a habitable planet with respect to the "classical" model results, in the region of maximum probability for this occurrence. These results are obtained by taking into account the supernova destruction processes. In particular, we find that in the Milky Way the maximum number of stars hosting habitable planets lies at 8 kpc from the Galactic center, and the model with radial flows predicts a number which is 38% larger than that predicted by the classical model.