Physically punishing her will only teach her to fear you in the long run; she's not attacking you with intent to harm, she's experiencing a mental glitch basically, so she won't put cause and effect together and understand that her pecking something causes you to hurt her.
What she's doing sounds like investigative pecking. It's the kind of behavior shown by an animal severely lacking instinct about what to eat. Normally you see this in very young chicks, and only very occasionally in adult chickens when exposed to something new.
When you see it expressed nonstop as you're seeing here, it is indicative of underlying problems. Instinct levels and accuracy of instinctive behaviors are severely altered in many modern breeds, especially commercial types like layers, so you will often see this in them.
Best bet is to keep the kids away from her for now, possibly forever, and maybe tell them she bites because she doesn't know what's food and what's not. In the meanwhile you can try to retrain her. It may not work, but I had biters who learned not to so there is hope. But it may take a fair while.
I'd do things like handfeed her daily, possibly even sit on the ground with something she likes scattered on your legs, hands etc so she can walk about pecking up the food and learning to leave your clothes/flesh alone. She will peck you numerous times as she learns but over time should come to identify what she is able to consume and what she can't. It may help to get something like raw pet mince for cats, something with no additives, or any food she goes crazy for, and feed her out of an almost completely closed fist, so she learns to avoid the fingers and skin to get to the treat. The same way you train a careless dog to carefully take the treat without biting fingers, basically.
She may be --- probably will be --- always a danger with earrings etc, it's beyond some chickens' intellectual capacities to understand they're not shiny insects, and she doesn't sound too bright to start with. If she goes nuts about shiny things, eyes will always be at risk around her, possibly teeth and mouths too. You could probably retrain her about that too by having shiny but inedible (meaning non-swallowable not just non-food) items around her until she stops responding. So, perhaps tinsel or glitter very securely glued to wood or something so she cannot peck it up, and learns to ignore it. It would need to be covered in a layer of perhaps woodglue to make sure she cannot swallow it.
I.Q. has a heck of a lot to do with diet and fluctuates throughout the average individual's lifetime, mainly based on dietary influences; she is not showing excessive smarts right now so treating that will definitely help. With many behavioral problems with all species, increasing nutrition will either eradicate or mitigate the problems. There are so many common behavioral issues I find are not faults of character but rather faults of health status... Everything from excessive fear to neuroses to obsessive stuff like this 'sampling the world' behavior she's showing.
If you add something like kelp to her food, (or any other decent and wide spectrum multi-vitamin/mineral mix), it will help. In humans iodine deficiency causes a drop of around 16 IQ points, and iodine deficiency is epidemic all over the world both in humans and animals. Kelp is high in iodine as well as many other necessary nutrients. You can get it from health food stores, produce stores, livestock suppliers, etc.
If using kelp just give a pinch a day on perhaps some wholemeal bread with cold pressed olive oil, this will help prevent so many health problems that are common as well as boost her IQ; there's a good chance she is pecking due to pica, a disorder causing confusion about what is edible and what is inedible, which is caused by extreme deprivation of nutrition. Most commercial layer types have some degree of pica and it can't be treated in all of them, for some it is a lifelong affliction.
The average commercial layer diet does not provide them with anything more than meager survival rations that enable them to live a short life before dying prematurely, and it causes a kind of derangement that manifests as you're seeing: in attempting to eat the whole world around them. Kelp helps address that desperate nutritional craving/seeking behavior. It also boosts IQ massively.
Best wishes.