To eat humble pie means to humbly apologize. It also means to give in under humiliating circumstances.
1. Despite Peter's bragging, he eventually had to eat humble pie as his project did not get the first prize.
2. The politician had to eat humble pie as his rival beat him by over 1 lakh votes.