Brain implant gives early warning of epileptic seizure