The cotton gin reduced the manual labor required, so that, and inventions like it, certainly would have eventually ended slavery, along with changing social attitudes.
The introduction of the cotton gin stimulated labor needs. Yes it “automated” a portion of the process but to growers that translated into the opportunity for larger crops (which translated into the need for more laborers, not less).
The election in 1860 was the writing on the wall. It signaled a departure from the status quo. If there was ever to be clarion call to adjust ones thinking and contemplate the possibilities of life without owning people this was it. But there was no “changing social attitudes”. Instead the southron slavers gave their countrymen the finger and a hearty “F-you!”.
Sometimes it takes a sharp rap on the skull to induce an attitude adjustment.