We study the critical behaviour of solutions to weakly dispersive Hamiltonian systems considered as perturbations of elliptic and hyperbolic systems of hydrodynamic type with two components. We argue that near the critical point of gradient catastrophe of the dispersionless system, the solutions to a suitable initial value problem for the perturbed equations are approximately described by particular solutions to the Painlevé-I (P[Formula: see text]) equation or its fourth-order analogue P[Formula: see text]. As concrete examples, we discuss nonlinear Schrödinger equations in the semiclassical limit. A numerical study of these cases provides strong evidence in support of the conjecture.