Numerical simulations within a cold dark matter (DM) cosmology form halos whose density profiles have a steep inner slope (`cusp'), yet observations of galaxies often point towards a flat central `core'. We develop a convolutional mixture density neural network model to derive a probability density function (PDF) of the inner density slopes of DM halos. We train the network on simulated dwarf galaxies from the NIHAO and AURIGA projects, which include both DM cusps and cores: line-of-sight velocities and 2D spatial distributions of their stars are used as inputs to obtain a PDF representing the probability of predicting a specific inner slope. The model recovers accurately the expected DM profiles: ∼82% of the galaxies have a derived inner slope within ±0.1 of their true value, while ∼98% within ±0.3. We apply our model to four Local Group dwarf spheroidal galaxies and find results consistent with those obtained with the Jeans modelling based code GravSphere: the Fornax dSph has a strong indication of possessing a central DM core, Carina and Sextans have cusps (although the latter with large uncertainties), while Sculptor shows a double peaked PDF indicating that a cusp is preferred, but a core can not be ruled out. Our results show that simulation-based inference with neural networks provide a innovative and complementary method for the determination of the inner matter density profiles in galaxies, which in turn can help constrain the properties of the elusive DM