So first, make a variable to multiply by GRAVITY to flip it.
var gravity_change = 1.0
At the top of physics_process, change the gravity code to this:
motion.y += GRAVITY * gravity_change
Then make a new input map named "flip_gravity":
if Input.is_action_pressed("flip_gravity"):
gravity_change = -1.0
else:
gravity_change = 1.0
That should be it. Cheers.