Thousands of people are fleeing Marawi city in southern Philippines as troops try to fend off Islamist militants there.