Actually, it is not needed to generate the html page for the gallery, but it is needed if someone executes the script as a standalone example (which can be useful).