The 44-year-old was in her home in Glasgow, with the child when her Staffordshire Bull Terrier escaped from a cage.
Within seconds the dog had a grip of the little girl and left her covered in blood and badly injured.
She phoned an ambulance and the child, who cannot be named for legal reasons, was taken to the Royal Hospital for Sick Children at Yorkhill where she had surgery on her right eye and needed more than 30 stitches.
At Glasgow Sheriff Court she pled guilty to having a dog that was dangerously out of control and attacked the youngster, on February 8, 2013 causing severe injury, permanent disfigurement and impairment.
She also admitted having an illegal Pit bull terrier dog contrary to the Dangerous Dogs Act.
Another charge relating to a previous attack by the dog in Glasgow, was dropped as part of a plea deal.
Sheriff Alan Miller handed Gray a community payback order with the condition she must carry out 100 hours of unpaid work, and he admonished her on the charge of owning a dangerous dog.
He said he was "satisfied" she would take extreme care in future herself.
Speaking at the court Gray said: "It was a tragic accident that night."
The extent of her injury will not be known until she is older
Both of Gray's dogs have since been destroyed.
Defence lawyer Callum Weir told the court: "Steps had been taken but somehow the dog seemed to overcome the security of the cage."