A family of finite-dimensional quantum systems with a nondegenerate ground state gives rise to a closed two-form on the parameter space, the curvature of the Berry connection. Its integral over a surface detects the presence of degeneracy points inside the volume enclosed by the surface. We seek generalizations of the Berry curvature to gapped many-body systems in D spatial dimensions which can detect gapless or degenerate points in the phase diagram of a system. Field theory predicts that in spatial dimension D the analog of the Berry curvature is a closed (D + 2)-form on the parameter space (the Wess-Zumino-Witten form). We construct such closed forms for arbitrary families of gapped interacting lattice systems in all dimensions. We show that whenever the integral of the Wess-Zumino-Witten form over a (D + 2)-dimensional surface in the parameter space is nonzero, there must be gapless edge modes for at least one value of the parameters. These edge modes arise even when the bulk system is in a trivial phase for all values of the parameters and are protected by the nontrivial topology of the phase diagram.