How to set animation float according to my mouse y axis?

I have an animation set to float, at 0 the characters spine is straight. At 1 the character spine bend backward to make it seem like hes looking up. At -1 the character spine bends forward to make it look down. Animations revert back to 0 almost instantly and causes the animation to jitter. Any help would be appreciated.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class test : MonoBehaviour
{

    
    
    Animator animator;


    

    

        void Start()
    {
        animator =  GetComponent<Animator>();
        

    }
  
    

    void Update()
    {

        float mousey = Input.GetAxis("Mouse Y");
        

        animator.SetFloat("LookUp", mousey);




    }

   
}

Input.GetAxis("Mouse Y") will get the speed of the mouse vertically. You need a float variable to add Input.GetAxis("Mouse Y") on to.

mousey += Input.GetAxis("Mouse Y") * Time.deltaTime;