A model for pion electro- and photo-production from threshold up to 1 GeV