If you see police approaching you, legally, you are allowed to leave and walk away if you have not been detained (for example if police have not said anything to you), but you may want to use your best judgment in the circumstances. Walking away from police, on its own, does not count as a legitimate reason for police to detain you.
But if you run away, in some circumstances this can be seen as a reason for police to detain or arrest you.