Software-Defined Automation for Grid Resiliency: Leveraging AI and ML for a Sustainable Energy Future