Maybe humans are not the best electricity generator, but slavery is far from obsolete. In fact, there are more slaves today than ever before in history although it's difficult to define exactly what a slave is (https://history.stackexchange.com/questions/41684/is-it-true...). Humans may not be so efficient but they sure are cheap, in some places as little as $90 (https://socialinnovation.blog.jbs.cam.ac.uk/2015/03/17/moder...). The sole reason slavery is not as widespread at least in the developed world is because of laws caused by some people having a conscious. When profit is in question unfortunately people will go very very far to minimize cost.
machine can work 24/7 and have infinitely more scalability, do you think we can harness planetary level of energy using human ?? I dn't think so
also one biggest part is predictability, human varies by value of work they can provide. with machine you can have one spec sheet and done with the day
that's why slavery is obsolete, we didn't need them anymore post industrial revolution