What wrong ? ERROR: UndefVarError: Gray not defined

julia> imagestrip(image::Matrix{<:Gray}) = Float32.(reshape(image, :))
ERROR: UndefVarError: Gray not defined
 [1] top-level scope
   @ REPL[43]:1

All code :https://betterprogramming.pub/handwriting-recognition-using-an-artificial-neural-network-78060d2a7963

It is missing the type Gray which the Plots.jl package will export for you. I see that using Plots is ran later in the tutorial so it is likely that the author just missed that it needed to be imported early and wanted to make it more pedagogical by importing it later when they did plotting.

But if you add a using Plots with the other using statements before the presented line, it should hopefully work fine.

I found that Flux.Data.MNIST also contains a const Gray = Colors.Gray{Colors.N0f8}. This is probably the one that should be used, not sure why it seems like it was exported in the tuturial but not now. You can import it by

using Flux.Data.MNIST: Gray
# As before
using Flux, Flux.Data.MNIST, Statistics
using Flux: onehotbatch, onecold, crossentropy, throttle
using Base.Iterators: repeated