Make my object's rotation "upright"

I’m making an android game with acceleration controls, and it works well so far but I’d like the rotation of the object to slowly upright itself while still moving in the current direction, while the player isn’t using any of the acceleration controls outside of a threshold. I’ve tried a lot of different things,but nothing is quite the effect I’m looking for. Any help would be appreciated!
void Update () {

		float phoneTurn = Input.acceleration.x;
		float phoneUpDown = Input.acceleration.z;
		test = -phoneUpDown;
		testTwo = phoneTurn;

		transform.Translate(Vector3.forward * Time.deltaTime*5);

		if ((phoneUpDown / 2) > .2) {
			transform.Rotate(Vector3.left * Time.deltaTime*80);
				} 
		if ((phoneUpDown / 2) < -.2) {
			transform.Rotate(Vector3.right * Time.deltaTime*100);
				}
		if((phoneTurn/2) > .2){
			transform.Rotate(Vector3.up * Time.deltaTime*100);
	
		}
		if((phoneTurn/2) < -.2){
			transform.Rotate(Vector3.down * Time.deltaTime*100);
		}
		else {

			transform.localRotation = Quaternion.Slerp(transform.localRotation, ???, Time.deltaTime * 2.3f);

		}
	}

Execute every frame in update:

  Quaternion q = Quaternion.FromToRotation(transform.up, vector3.up) * transform.rotation;
  transform.rotation = Quaternion.Slerp(transform.rotation, q, Time.deltaTime * speed);

‘speed’ is a variable you define. Initialize it with a value of 3.5f to start.